0

我是 Jquery Mobile 的新手,我有使用 HTML5 作为显示创建的登录表单

<div data-role="content" class="content-min-height">
    <form name="frm_login" id="frm_login" >
        <label>Email ID</label> 
        <input 
        type="text" 
        width="40" 
        data-theme="d" 
        name="email"
        />
        <label>Password</label> 
        <input type="Password" width="50" data-theme="d" name="pwd"/>
        <p class="tekmaz-p-center padding-add">
            <input type="submit" name="btn_login" value="Login" class="btn-width-a" id="login"/>
            </p>

    </form>
    <div data-role="content" id="display"></div>
</div>

在我的 javascript 文件中是

         // JavaScript Document
        $( document ).bind( "mobileinit", function() {
          // Make your jQuery Mobile framework configuration changes here!

          $.mobile.allowCrossDomainPages = true;
        });

    $(document).ready(function() {

        $("#login").click(function(){
            ajFrmLogin();
            return false;
        });
    });
    function ajFrmLogin(){

        var datas = $("#frm_login").serialize();
        //var datas = {0:"ABS",1:"pwddd"};
        $.ajax({

              url: "http://mydomain.com/core/validate.php",
              data: datas,
              cache: false,
              dataType: 'jsonp',
              jsonp: 'jsoncallback',
              timeout: 5000,
              success: function(rtdata,status){
                  $("#display").html(rtdata.email);

              }
        });
   }

这段代码在 android 模拟器中工作,但是当我把它放在实际的 android 设备上时,我不会得到任何结果,正如我在 android 模拟器中所期望的那样。

请帮我解决这个问题

4

1 回答 1

0

而不是使用$("#login").click(function()尝试,

$('#frm_login').submit(function(){
   ajFrmLogin();
});
  • 还要检查在您的 html 中正确排序的 javascript 文件。
于 2012-08-25T20:39:06.850 回答