Subversion Repositories SmartDukaan

Rev

Rev 21998 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21998 Rev 22030
Line 734... Line 734...
734
 var isChecked = jQuery("input[type=checkbox]:checked").val();
734
 var isChecked = jQuery("input[type=checkbox]:checked").val();
735
      if(!isChecked){
735
      if(!isChecked){
736
          alert('Please select the Status of shop');
736
          alert('Please select the Status of shop');
737
           return false;
737
           return false;
738
     }
738
     }
739
      formData = new FormData($(this)[0]);
-
 
740
      submitForm(formData);
739
      submitFormAsJson($(this));
741
      });
740
      });
742
    }
741
    }
743
 
742
 
744
 
743
 
745
 
744
 
746
function submitForm(formData){
745
function submitFormAsJson(jQueryForm){
747
    jQuery.blockUI({ message: "<h5>Please wait while we upload data to our server</h5>" });
746
    jQuery.blockUI({ message: "<h5>Please wait while we upload data to our server</h5>" });
748
    
747
    
749
    jQuery.ajax({
748
    jQuery.ajax({
750
        url: contexPath +"/register",
749
        url: contexPath +"/register",
751
        type: 'POST',
750
        type: 'POST',
752
        data: formData,
751
        data: JSON.stringify(objectifyForm($("form").serializeArray())),
753
        success: function (data) {
752
        success: function (data) {
754
            //$('#form')[0].reset();
753
            //$('#form')[0].reset();
755
        	jQuery.unblockUI();
754
        	jQuery.unblockUI();
756
        	jQuery("html").html(data);
755
        	jQuery("html").html(data);
757
        },
756
        },
Line 761... Line 760...
761
     },
760
     },
762
        cache: false,
761
        cache: false,
763
        contentType: false,
762
        contentType: false,
764
        processData: false
763
        processData: false
765
    });
764
    });
-
 
765
}
-
 
766
//serialize data function
-
 
767
function objectifyForm(formArray) {
-
 
768
 
-
 
769
	  var returnArray = {};
-
 
770
	  for (var i = 0; i < formArray.length; i++){
-
 
771
	    returnArray[formArray[i]['name']] = formArray[i]['value'];
-
 
772
	  }
-
 
773
	  return returnArray;
766
}
774
}
767
775