Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Main = {
  2.         sendZakaz:function( form, cart ) {
  3.         $(form).find('.submit').prop('disabled', true);    
  4.  
  5.         console.log(cart)  
  6.         return false;      
  7.  
  8.     data = new FormData(form);
  9.  
  10.     //в зависимости от того, что возвращает FormData
  11.     //объект
  12.     data["cart"] = cart;
  13.     //или строку
  14.     data += "&cart=" + JSON.stringify(cart);
  15.  
  16.         $.ajax({
  17.             url: "sendZakaz",
  18.             type: "POST",
  19.             data:  data,
  20.             contentType: false,
  21.             cache: false,
  22.             processData:false,
  23.             success: function(data){                
  24.                 var obj = jQuery.parseJSON(data);      
  25.                 $(form).find('.submit').prop('disabled', true);
  26.  
  27.                 /*if(obj.error == 0){
  28.                     $('input[name="name"], textarea[name="zakaz"]').val('');                        
  29.                     $('#okey').text(obj.message);
  30.                     $('#okey').slideDown('fast');
  31.                     setTimeout(function(){
  32.                         $('#okey').slideUp('fast');
  33.                     }, 2000)
  34.                     return false;
  35.                 }
  36.  
  37.                 $('#nookey').text(obj.message);
  38.                 $('#nookey').slideDown('fast');
  39.                 setTimeout(function(){
  40.                     $('#nookey').slideUp('fast');
  41.                 }, 2000)
  42.                 return false; */                
  43.             }          
  44.         })  
  45.         return false;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement