ajax jquery code does not work on android -Phonegap-

為{幸葍}努か 提交于 2019-12-11 14:53:12

问题


I created a mobile application using the phonegap framework and it worked well in ios and android but the problem is that the ajax jquery code does not work on android

Thank you for helping me find a solution

ajax jquery code

$ (document) .ready (function () {
$ .Ajax ({
url: "http://rest-service.guides.spring.io/greeting"
}). then (function (data) {
. $ ( '. Greeting-id') append (data.id);
. $ ( '. Greeting-content') append (data.content);
});

回答1:


When you are working on app which wants to access the internet, you need to add extra permission in androidManifest.xml else your application won’t be able to access the internet. So you need to put below code in AndroidManifest.xml file to access the internet in your app.

Add Below permission in AndroidManifest.xml file.
Step 1 :

Go to app -> src -> main -> AndroidManifest.xml.

Step 2 :

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


来源:https://stackoverflow.com/questions/56407428/ajax-jquery-code-does-not-work-on-android-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!