phonegap ajax方法帖子错误404找不到



使用方法GET运行良好,但POST给出错误。我已经尝试使用cordova-plugin-whitelist,但没有运气仍然给出错误404。

这是我的ajax代码

function GetSlider(){
    serverRoot = "/js/ajax.php";
    $.ajax({
        type: "post",
        url: serverRoot,
        data: "act=GetSlider",
        dataType: "JSON",
        beforeSend: function(){
            $("#loading").show();
        },
        success: function(){
            $("#loading").hide();
        }
    });         
}

config.xml

<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="~1.2.2" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<allow-navigation href="dubailibrary.com*" />
<access origin="*" />

检查此屏幕截图

响应: Cannot POST /js/ajax.php

尝试使用内容安全策略方法:Cordova插件白名单

相关内容

最新更新