Jquery Ajax不能与Phonegap一起使用

Jquery Ajax不能与Phonegap一起使用

问题描述:

我刚接触Phonegap。我试图在我的移动应用程序中使用AJAX调用,当我调用url,我收到错误。没有结果是来自我从我使用的url。当我尝试在浏览器中的相同的URL,我得到的结果以json格式。

I'm new to Phonegap. I'm trying to use AJAX call in my mobile application, when i call the url, I'm getting error. No result is coming for me from the url which i'm using . when i try the same URL in browser i'm getting the result in json format.

我在Ajax请求标头中关闭连接时收到错误。

I'm getting the error as Connection closed in the Ajax request headers.

欢迎任何建议。

检查res / xml文件夹中的config.xml文件
并用以下代码替换访问来源



Check your config.xml file in res/xml folder and replace access origin with the following code

<access origin="*" />

还会检查minifest文件:

also check the minifest file if you have enabled the following permission:

<uses-permission android:name="android.permission.INTERNET" />