AJAX呼叫不适用于phonegap APK构建 [英] AJAX calls don't work on phonegap apk build

查看:75
本文介绍了AJAX呼叫不适用于phonegap APK构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用build.phonegap时,我所有的ajax调用均不起作用,它以网站形式工作,并且在使用该应用程序连接到服务器时起作用,但是一旦我构建了AJAX调用,便会通过,但不会在该应用程序上更新(如果单击该网站,我会在apk上看到所做的更改,但在电话上看不到)

When using build.phonegap all of my ajax calls dont work, it works in website form and when using the app to connect to the server, but once i build the AJAX calls go through, but don't update on the app (if I click to the website i see the changes made on the apk, but not on the phone)

我的config.xml文件是

My config.xml file is

<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:android = "http://schemas.android.com/apk/res/android">
    <name>Carello</name>
    <description>
       Carello
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/jrontend/phonegap-plugin-barcodescanner" />

    <engine name="browser" spec="~5.0.4" />
    <engine name="android" spec="^7.1.4" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <config-file target="AndroidManifest.xml" parent="/*" mode="merge">
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
    <access origin="*" launch-external="yes" />
    <content src="index.html" />
    <allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
    <gap:platform name="android" />
</widget>

我也有

<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' data: gap: 'unsafe-eval'; style-src * 'self' 'unsafe-inline';  connect-src * ;  script-src * 'self' 'unsafe-inline';  media-src *">

在我的html文件中.

in my html files.

推荐答案

AndroidManifest.xml文件中添加以下权限.

Add Below permission in AndroidManifest.xml file.

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

这篇关于AJAX呼叫不适用于phonegap APK构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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