joris

Ajax

Mar 28th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script language="javascript">
  2.    
  3.     $(document).ready(function(){
  4.         $("#submit").click( function (){
  5.         $.ajax({
  6.                type: "POST",
  7.                url : 'http://www.berthojoris.com/dev/jqm/login_cek.php',
  8.                data: {
  9.                   username:$('#username').val(),
  10.                   password:$('#password').val(),
  11.                },
  12.                dataType: "json",
  13.                success: function (data) {
  14.                     if (data.response=='SuksesLogin') {
  15.                         jAlert('Login Successfully', 'Success');
  16.                     } else {
  17.                         jAlert('Login Failed', 'Fail');
  18.                     }
  19.                 }
  20.       });
  21.     });
  22. });
  23.  
  24.    
  25.     function validateForm(){
  26.           var CekNama=document.forms["komentar"]["nama"].value;
  27.           if (CekNama==""){
  28.              jAlert('Nama anda belum dimasukan', 'Follow Rules');
  29.              return false;
  30.              }
  31.     }
  32.    
  33.     function ClearForm(){
  34.         document.forms["login"]["username"].value = ""
  35.         document.forms["login"]["password"].value = ""
  36.     }
  37.  
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment