Advertisement
Guest User

jquery sweetalert2

a guest
Jul 17th, 2016
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.    
  3.         function akayit(){
  4.             var eposta = $("input[name=eposta]").val();
  5.             eposta = $.trim(eposta);
  6.            
  7.             var epostaconfirm = $("input[name=epostaconfirm]").val();
  8.             epostaconfirm = $.trim(epostaconfirm);
  9.            
  10.         var pass = $("input[name=pass]").val();
  11.             pass = $.trim(pass);
  12.            
  13.         if(eposta == ""){
  14.             sweetAlert(
  15.   'Oops...',
  16.   'Please write your mail adress!',
  17.   'warning'
  18. );
  19.         }else if(pass==""){
  20.             sweetAlert(
  21.   'Oops...',
  22.   'Please write your password!',
  23.   'warning'
  24. );
  25.         }else if(epostaconfirm==""){
  26.             sweetAlert(
  27.   'Oops...',
  28.   'Please write again your email adress',
  29.   'warning'
  30. );
  31.         }else if (eposta != epostaconfirm) {
  32.             sweetAlert(
  33.   'Oops...',
  34.   'Your e-mail adress is wrong!',
  35.   'warning'
  36. );
  37.         }
  38.        
  39.         else{
  40.             var deger = "eposta="+eposta+"&pass="+pass;
  41.            
  42.             $.ajax({
  43.                 type : "POST",
  44.                 url  : "signup.php",
  45.                 data : deger,
  46.                 success : function(sonuc){
  47.                     if(sonuc == "ok"){
  48.                         swal(
  49.   'Good job!',
  50.   'You have successfully signed up!',
  51.   'success'
  52. );
  53.                     }else if(sonuc =="hata"){
  54.                         swal(
  55.   'Ohh no!',
  56.   'There is some mistake!',
  57.   'error'
  58. );
  59.                     }else if(sonuc=="kayitlimail"){
  60.                         swal(
  61.   'Hoppa!',
  62.   'This email adress already registered our system!',
  63.   'warning'
  64. );
  65.                     }else if(sonuc=="hatalimail"){
  66.                         swal(
  67.   'Hoppa!',
  68.   'This email format is wrong!',
  69.   'warning'
  70. );
  71.                     }
  72.                 }
  73.             })
  74.         }
  75.         }
  76.    
  77.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement