ajax jQuery代码在android -Phonegap-上不起作用 [英] ajax jquery code does not work on android -Phonegap-

查看:116
本文介绍了ajax jQuery代码在android -Phonegap-上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用phonegap框架创建了一个移动应用程序,它在ios和android上都运行良好,但是问题是ajax jQuery代码在android上不起作用

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代码

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);
});

推荐答案

在开发要访问互联网的应用程序时,您需要在androidManifest.xml中添加额外的权限,否则您的应用程序将无法访问互联网. 因此,您需要在AndroidManifest.xml文件中放置以下代码,以访问应用程序中的互联网.

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.

在AndroidManifest.xml文件中添加以下权限.
步骤1:

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

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

第2步:

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

这篇关于ajax jQuery代码在android -Phonegap-上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆