Advertisement
chernov2000

Отправка формы на AJAX

Oct 21st, 2022
841
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('.uk_form_post_02').submit(function(event) {     
  2.     var data = $(this).serialize();
  3.     $.ajax({
  4.         type: "POST",
  5.         url: "/local/ajax/zayavka_arenda.php",
  6.         data: data
  7.     }).done(function( msg ) {
  8.         if(msg == 'OK') {              
  9.             $('.detail_done_02').css('display', 'block');
  10.             $('.detail_error_02').css('display', 'none');
  11.             setTimeout(function() {
  12.                 console.log(msg);
  13.             }, 3000)
  14.         } else {
  15.             $('.detail_done_02').css('display', 'none');
  16.             $('.detail_error_02').css('display', 'block');
  17.             setTimeout(function() {
  18.                 console.log(msg);
  19.             }, 3000)
  20.         }
  21.     });
  22.     return false;
  23.     });
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement