Advertisement
joris

Login jQuery

Aug 12th, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.15 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0">
  6. <title>Online News Application</title>
  7. <link rel="stylesheet" href="css/style_acc.css" type="text/css" />
  8. <link rel="stylesheet" href="css/fb-buttons.css">
  9. <link href="css/fb-1.css" rel="stylesheet" type="text/css" />
  10. <link href="css/fb-3.css" rel="stylesheet" type="text/css" />
  11. <link href="css/jquery.alerts.css" rel="stylesheet" type="text/css" />
  12.  
  13.         <script src="js/jquery-1.7.1.min.js"></script>
  14.         <script src="js/jquery.mobile-1.1.0.min.js"></script>
  15.         <script src="js/jquery.alerts.js"></script>
  16.  
  17.        
  18. <script language="javascript">
  19.    
  20.     $(document).ready(function(){
  21.         $("#submit").click( function (){
  22.             var username = $('#username').val();
  23.             var password = $('#password').val();
  24.            
  25.             $.ajax({
  26.                type: "POST",
  27.                url : 'http://www.myurl.com/login.php',
  28.                cache: false,
  29.                data: {
  30.                   username:$('#username').val(),
  31.                   password:$('#password').val(),
  32.                },
  33.                dataType: "json",
  34.                success: function (data) {
  35.                     if (data.response=='Success') {
  36.                         self.location="admin.html";
  37.                     } else {
  38.                         jAlert('Username dan Password wrong', 'Login Failed');
  39.                         ClearForm();
  40.                     }
  41.                 },
  42.                 error : function(data) {
  43.                        jAlert('Check your connection', 'Connection');
  44.                }
  45.       });
  46.        
  47.     });
  48. });
  49.  
  50.    
  51.     function ClearForm(){
  52.         document.forms["login"]["username"].value = ""
  53.         document.forms["login"]["password"].value = ""
  54.         document.login.username.focus();
  55.     }
  56.  
  57. </script>
  58.  
  59. </head>
  60. <body style="background-color:#e6eae9" OnLoad="document.login.username.focus();">
  61.  <div class="uibutton-toolbar" style="background-color:#FFF;text-align:center">
  62.                 <a class="uibutton confirm" rel="external" href="index.html">Home</a>
  63.                 <a class="uibutton confirm" rel="external" href="news_list.html">Online News</a>
  64.                 <a class="uibutton confirm" rel="external" href="report.html">Report Application</a>
  65.                 <a class="uibutton confirm" rel="external" href="about.html">About Application</a>
  66.                 <a class="uibutton special" rel="external" href="login.html">Login</a>
  67. </div>
  68.            
  69.            
  70.            
  71. <ul class="acc" id="acc" >
  72.     <li>
  73.                         <h3>Login Form</h3>
  74.                         <div class="acc-section_hitam">
  75.  
  76.                             <div class="acc-content_hitam">
  77.                                 <div class="section">
  78.        <p>Silahkan masukan username dan password untuk mendapatkan akses ke menu administrator. Aplikasi akan memeriksa data anda.</p>
  79.         <br />
  80.         <div id="message_ajax"></div>
  81.        
  82.         <form name="login" method="post">
  83.         <table id="mytable" style="width:425px;">
  84.  
  85.   <tr>
  86.     <td width="141" style="text-align:right">Username</td>
  87.     <td width="10">:</td>
  88.     <td width="258"><input name="username" type="text"  class="inputtext" id="username" ></td>
  89.   </tr>
  90.  
  91.   <tr>
  92.     <td class="alt" style="text-align:right">Password</td>
  93.     <td width="10">:</td>
  94.     <td class="alt"><input name="password" type="password"  class="inputtext" id="password" ></td>
  95.   </tr>
  96.  
  97.   <tr>
  98.     <td class="alt"></td>
  99.     <td class="alt"></td>
  100.     <td class="alt">
  101.     <input style="width:74px;" class="uibutton confirm" id="submit" value="Login">
  102.     <input style="width:74px;" class="uibutton" onClick="ClearForm();" value="Reset" >
  103.     </td>
  104.   </tr>
  105.  
  106. </table>
  107. </form>
  108.         </div>
  109.         <br />
  110.        
  111.             <div class="uibutton-toolbar">
  112.               Created By : Bertho Joris
  113.             </div>
  114.         </div>
  115.     </div>
  116.                             </div>
  117.                         </div>
  118.                     </li>
  119. </ul>
  120.  
  121. </body>
  122. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement