是否需要使用forge.request.ajax而不是$ .post?(Is it required that I use forge.request.ajax in stead of $.post?

编程入门 行业动态 更新时间:2024-10-21 18:38:31
是否需要使用forge.request.ajax而不是$ .post?(Is it required that I use forge.request.ajax in stead of $.post?)

首先,我不是要尝试跨站点请求。

我已经创建了一个小型的JS应用程序,我可以在浏览器中测试它,它工作正常我。

我看到我的应用程序的请求进入我的服务器,我可以确认我的服务器响应我期望的数据。 问题是编译的应用程序在我的javascript中触发.fail。

是否需要使用forge.request.ajax。 而不是$ .post? 我看到很多帖子说我应该但是没有人说我不能使用$ .post。它使调试和开发更容易在制作包之前能够在浏览器中测试我的所有JS。

First , I am not trying to do a cross site request.

I have created a small JS app and I can test in in a browser and it works fine i.

I see that my request from the app makes it to my server and I can confirm that my server responds with the data I expect. The problem is that the compiled app triggers the .fail in my javascript.

Is is REQUIRED that I use forge.request.ajax. instead of $.post? I see many posts saying I should but no one says I cannot use $.post .It makes debugging and development much easier being able to test all my JS in a browser before making the package.

最满意答案

不幸的是,我还没有找到解决办法。 您可以使用promise ,创建包装函数/服务,检测正在运行的平台并调用相应的函数。

Unfortunately I haven't found a way around it. You can use a promise, create a wrapper function/service, detect the platform that you are running on and call the corresponding function.

更多推荐

本文发布于:2023-07-16 13:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128991.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   ajax   request   forge   required

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!