phonegap与$.ajax(Android)

phonegap与$.ajax(Android),android,jquery,cordova,Android,Jquery,Cordova,使用phonegap,我试图从服务器获取json数据。但它总是执行onCreateReportError方法并给出status=0。我检查了其他stackoverflow的相关问题,代码中似乎没有任何错误。可能是什么问题 $('#randomPerson').click(function(){ $.ajax({ type : "POST", url : 'http://localhost:9090/mvc-1.0.0-BUILD-SNAPSHOT/

使用phonegap,我试图从服务器获取json数据。但它总是执行onCreateReportError方法并给出status=0。我检查了其他stackoverflow的相关问题,代码中似乎没有任何错误。可能是什么问题

$('#randomPerson').click(function(){
    $.ajax({
          type : "POST",
          url : 'http://localhost:9090/mvc-1.0.0-BUILD-SNAPSHOT/api/person/random',
            crossDomain: true,
            beforeSend : function() {$.mobile.loading('show')},
            complete   : function() {$.mobile.loading('hide')},
            dataType   : 'json',
          data : {},
          success: onCreateReportSuccess,
         error : onCreateReportError
        });


    function onCreateReportSuccess(person, textStatus, jqXHR) {
        console.log('Status: ' + textStatus);
        $('#personResponse').text(person.name + ', age ' + person.age);
    }

    function onCreateReportError(jqXHR, textStatus, errorThrown) {
        console.log('Status: ' + textStatus);
        console.log('Error: ' + errorThrown);
        alert('Error creating report');
    }
});

您正在设备上测试吗?是
http://localhost:9090/
从那里可以到达吗?

嗯,看来这就是问题所在。谢谢你的快速回复。如果这是正确的答案,请标记为已回答?