首先,我不是要尝试跨站点请求。
我已经创建了一个小型的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.
更多推荐
发布评论