Javascript cordova中的getJSON没有结果

Javascript cordova中的getJSON没有结果,javascript,php,jquery,json,cordova,Javascript,Php,Jquery,Json,Cordova,我的cordova应用程序有问题。我有一个带有带有JSON输出的迷你REST服务的php页面,我想在我的应用程序中使用这个结果 Php页面: <? header("Content-Type:application/json"); function response($status, $status_message, $data){ header("HTTP/1.1 $status $status_message"); echo $data; } $link = my

我的cordova应用程序有问题。我有一个带有带有JSON输出的迷你REST服务的php页面,我想在我的应用程序中使用这个结果

Php页面:

<?
header("Content-Type:application/json");

function response($status, $status_message, $data){
    header("HTTP/1.1 $status $status_message");

    echo $data;
}


$link = mysqli_connect("db4free.net", "luigi", "nzor4csv4", "usl5");
if (mysqli_connect_errno()) {
    response(400, "Failed to connect to MySQL", mysqli_connect_error());
}


if( !empty($_GET['prestazioni']) ){
    //make response using database 
    $result = mysqli_query($link,"SELECT DISTINCT `ppasez_descrizione` FROM `prestazioni`");

    $arr = array();

    while($obj = mysqli_fetch_assoc($result)) {
        $arr[] = $obj;

    }
    $message= json_encode($arr);

    response(200, "lista prestazioni", $message);
} else {
    //invalid request
    response(400, "invalid request", NULL);
}
?>

所以cordova包的链接可能有一些错误,但我使用netbeans,所以它是自动的。 有人能帮我找到错误吗

谢谢大家

根据

白名单规则可在res/xml/cordova.xml中找到


尝试将该规则添加到res/xml/cordova.xml

可能是因为您尝试仅使用本地主机而不使用真实的计算机名进行访问。输入主机名或IP地址


这意味着你需要改变http://localhost:8383/ 差不多http://192.168.1.1:8383/ 或http://fastbox:8383

这可能看起来很奇怪,但在项目文件夹中,我没有res文件夹,因此我在www文件夹下创建了res/xml/cordova.xml,其中包含白名单,但仍然不起作用是的。我不知道这是否是netbeans的问题
<html>
<head>
    <meta charset="utf-8" />
    <script type="text/javascript" src="cordova.js"></script>
    <link rel="stylesheet" href="js/libs/jquery-mobile/jquery.mobile.css" />
    <script type="text/javascript" src="js/libs/jquery/jquery.js"></script>
    <script type="text/javascript" src="js/libs/jquery-mobile/jquery.mobile.js"></script>

    <script type="text/javascript" src="js/mainjs.js"></script>
    <script>
        $(document).ready(function(){
            $.support.cors=true;
            $.mobile.allowCrossDomainPages = true;
            $("button").click(function(){
                $.getJSON('http://www.****.it/provaluigi/index.php?prestazioni=""',function(data){
                    $.each(data, function(i, dat){
                        $("ul").append("<li>"+dat.ppasez_descrizione+"</li>");  
                    });
                    $('ul').listview('refresh');
                    //if $("list") do $("list").listview("refresh);
                });
            });
        });
    </script>
    <title>
        Prestazioni
    </title>
</head>

<body>
    <section id="page1" data-role="page" data-fullscreen="true">
        <div class="content" data-role="content">
            <ul data-role="listview" data-filter="true" data-filterplaceholder="cerca prestazione">
            </ul>
        </div>
    </section>
</body>
            $.support.cors=true;
            $.mobile.allowCrossDomainPages = true;
<access origin="*"/>
Failed to load resource    http://localhost:8383/Centri%20USL/config.xml
Failed to load resource: net::ERR_EMPTY_RESPONSE     http://localhost:8383/Centri%20USL/cordova.js