问题
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