来自phonegap的PHP Web服务调用无效?

时间:2015-07-16 06:17:32

标签: javascript android jquery web-services cordova

我尝试在phonegap中使用以下代码来调用php webservice。我在eclipse网页浏览器中测试了这段代码,效果很好; Web服务获得成功响应。但是当我将项目作为android app运行时。 Web服务失败,收到错误消息。我检查了互联网权限,没关系。我不知道那里发生了什么。是否有任何强制访问权限来呼叫服务?

<html>
    <head>
    <title></title>
    <script src="jquery.mobile/jquery-1.7.2.min"></script>
    <script type="text/javascript">
        function clickJson(){
            $.ajax({
                type: "POST",
                datatype:"JSON",
                //(Following url changed...) Working url. No problem with it...
                url: "http://www.domain.com/webservice/profile_details?panelist_id=1&panel_id=1",
                success: function(msg){
                    if (msg != ''){
                        alert("ok ");
                    }
                    else{
                        alert("No login details");
                    }
               },
               error : function(request, status, error)
               {
                   alert('error'+request.responseText);
               }
           });
        }
    </script>
    </head>
    <body style="padding:0; margin:0;">
         <button id="btnJson" onclick="clickJson();">JSON</button>
    </body>
</html>

0 个答案:

没有答案
相关问题