使用jquery mobile的移动登录表单

时间:2014-10-30 18:37:41

标签: android jquery-mobile xampp dreamweaver

我想在Android上制作一个移动应用程序,我使用adobe dreamwever cs6,php和mysql(在XAMPP上捆绑)。我的登录过程有问题。 你能告诉我我的代码的错误在哪里吗?因为当我按下登录按钮时,我的登录表单只停留在加载程序上请帮帮我。

这是我在Dreamweaver上的index.html代码......

<!DOCTYPE html> 
<html>
<head>
  <meta charset="utf-8">
  <title>Login Form</title>
  <link href="jquery-mobile/jquery.mobile.theme-1.4.4.min.css" rel="stylesheet" type="text/css"/>
  <link href="jquery-mobile/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet"    type="text/css"/>
  <script src="jquery-mobile/jquery-1.11.1.min.js" type="text/javascript"></script>
  <script src="jquery-mobile/jquery.mobile-1.4.4.min.js" type="text/javascript"></script>
  <script>
    $(document).ready(function() {
      $("#btnLogin").click(function() {
        username=$("#username").val();
        password=$("#password").val();
        $.ajax({
            type:'POST',
            url:"login.php",
            data:"username="+username+"&password="+password,
            success: function(data){
                    if(data=='true'){
                            window.location ( "hhome.html");                                
                        } else {
                                $("#add_err").html("<img src='images/icons-png/alert-black.png' />Wrong Username or Password!!");
                            }
                },beforeSend: function()
                {
                    $("#add_err").html("<img src='images/ajax-loader.gif' />")
                    }
        });
        return false;
});
});
</script>
</head> 
  <body> 

    <div id="page" data-role="page" >
      <div data-role="header" data-theme="b" >
        <h1></h1>
      </div>
      <div align="center" data-role="content" data-theme="a" >  
         <img src="sma-baktiidhata.jpg" width="214" height="178"><br>
           <p>Go to the login page</p><br><br>
           <a href="#page2" data-role="button">Login</a>     
      </div>
      <div data-role="footer" data-theme="b" >
           <h4></h4>
      </div>
    </div>

    <div data-role="page" id="page2">
      <div data-role="header" data-theme="b">
         <h1>Login User</h1>
      </div>
      <div data-role="content">
        <form action="login.php" method="post" id="add_err">
           <div data-role="fieldcontain">    
           <input type="text" name="username" id="username" value="" placeholder="Username" />        
           <input name="password" type="password" id="password" placeholder="Password" value="" maxlength="10" />
           </div>
           <input name="Submit" type="submit" id="btnLogin" value="Login" />        
        </form>
     </div>
     <div data-role="footer" data-theme="b">
         <h5>&copy; 2014 </h5>
     </div>
    </div>

</body>
</html>

0 个答案:

没有答案