English 中文(简体)
Can t 接获“Query”职位,要求他们在电话中工作
原标题:Can t get jQuery post request to work in phonegap

我正试图用jQuery和Ajax向一个远程服务器发送一些表格数据。 我的法典在我的当地机器上打着火法英,但当我用我的电话(安德罗德)发射时,它赢得了笔工作。 是否需要修改或增加《酒类法》中的内容,使之在电话中发挥作用?

我在 and子号上增加了国际互联网许可。

<!DOCTYPE HTML>
<html>
    <head>
        <title>Phonegap ajax test</title>

        <meta name="viewport" content="width=240, height=320, user-scalable=yes, initial-scale=2.5, maximum-scale=5.0, minimum-scale=1.0" />
        <script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/jquery.mobile-1.0rc2.js"></script>

        <link rel="stylesheet" type="text/css" href="css/layout.css" />
        <link rel="stylesheet" type="text/css" href="js/jquery.mobile-1.0rc2.css" />

        <script type="text/javascript">    
            $(document).ready(function() {
                $( #infoForm ).submit(function() {
                    var postTo =  http://www.mysite.com/process.php ;

                    $.post(postTo,$( #infoForm ).serialize(), function(data) {
                        alert(data);       
                    });
                    return false;
                }); 

            });
        </script>
    </head>

    <body>      
        <div data-role="content">   
            <form method="post" id="infoForm">
                <input type="text" name="first_name" id="first_name" value="" placeholder="First Name"  />
                <input type="text" name="last_name" id="last_name" value="" placeholder="Last Name"  />   
                <input type="text" name="email" id="email" value="" placeholder="Email"  />
                <button type="submit">Submit</button> 
            </form>
        </div><!-- /content -->
    </body>
</html>

感谢!

最佳回答

在安乐器/雕塑器的编码工作之后,你可以利用jquery-1.4.2.js

<html>
<head>
<script src="js/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script>
function bodyload(){
    alert("We are calling jquery s ajax function with the post type request");
$.ajax({  
    url: http://www.edumobile.org/blog/uploads/XML-parsing-data/Data.xml ,  
    dataType: application/xml , 
    timeout:10000,  
    type: POST ,  
    success:function(data) {
       alert(data);
     },  
    error:function(XMLHttpRequest,textStatus, errorThrown) {     
      alert("Error status :"+textStatus);  
      alert("Error type :"+errorThrown);  
      alert("Error message :"+XMLHttpRequest.responseXML);
    }
    });
}   
</script>
</head>
<body onload="bodyload()">
<button onclick="bodyload()">Ajax call</button>
</body>
</html>
问题回答

确保在你看来有适当的许可。

增 编

<uses-permission android:name="android.permission.INTERNET" />

<>AndroidManifest.xml

<access origin="*"/>

<>res/xml/phonegap.xml





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签