SHARE
TWEET

ajax

eladha Dec 13th, 2016 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //ارسال بيانات فوم بدون تحديث الصفحة عن طريق اجاكس
  2. $(document).ready(function(){
  3.    $('#submit').click(function(){
  4.        $.ajax({
  5.             type:'POST',
  6.             url:$('#form').attr('action'),
  7.             data:$('#form').serialize(),
  8.             success:function(dt){
  9.                $('#rez').text('dt');
  10.            }
  11.        });
  12.    });
  13. });
  14.  
  15. <div id='rez'><div/>
  16. <form action='ajax.php' id='form' method='post'>
  17.   User :
  18. <input type='text' name='user'/>
  19. <br />
  20.   Pass :
  21. <input type='password' name='pass' />
  22. <br />
  23. <input type='submit' name='submit' value='Login' id='submit' />
  24. </form>
  25.  
  26. <?php
  27.   $user=$_POST['user'];
  28.   $pass=$_POST['pass'];
  29.   $subm=$_POST['submit'];
  30.  
  31.   if(isset($subm)){
  32.     if(empty($user) or empty($pass)){
  33.       echo " please check your information  and try agian .. ";
  34.     }else{
  35.       echo $user."<br />".$pass;
  36.     }
  37.   }
  38. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top