Jquery phonegap android ajax调用不起作用

Jquery phonegap android ajax调用不起作用,jquery,ajax,cordova,Jquery,Ajax,Cordova,我试图从带有phonegap平台和jquery库的EclipseAndroid仿真器调用ajax到我正在开发的计算机。下面是我的服务器在我的计算机上运行的场景,与emulator相同。当我尝试像这样使用ajax调用时: $.ajax({ type : "POST", url : "http://10.4.40.235/API.public/index.php", success : function(data)

我试图从带有phonegap平台和jquery库的EclipseAndroid仿真器调用ajax到我正在开发的计算机。下面是我的服务器在我的计算机上运行的场景,与emulator相同。当我尝试像这样使用ajax调用时:

$.ajax({
            type : "POST",
            url : "http://10.4.40.235/API.public/index.php",
            success : function(data)
            {
                alert(data);
            }
 });
它不起作用。我假设是因为跨域ajax请求,但我如何才能做到这一点。我也尝试了10.0.2.2IP,但效果不太好。花了几个小时,却似乎一事无成。。。。我的模拟器和pc上的服务器是连接的,因为如果我使用浏览器访问10.4.40.235/API.public/index.php,它就可以工作了

在LogCat中,我得到以下错误:

WEb Console: Uncaught SyntaxError: Unexpected indetifier at: http://10.0.2.2/API.public/index.php?calback=jQuery[some numbers]
enter code here

经过3个小时的工作,我得到了解决方案…这对我来说是有效的

$.get('http://10.0.2.2/API.public/index.php', function (data) {
    alert(data);
});

Phonegap应用程序不存在跨域问题,并且logcat控制台中是否存在任何异常?能否尝试转义URL:
encodeURI(“http://10.4.40.235/API.public/index.php“”