how to perform some action before submit form via .ajaxForm()?

后端 未结 3 846
刺人心
刺人心 2021-02-15 11:44

i am using ajaxForm() frame work to send my data without reloading my page.

    $(\'#ReplayForm\').ajaxForm({ 

      success : function(data){
             aler         


        
3条回答
  •  旧时难觅i
    2021-02-15 12:10

    Yes, definatly you can handle this situation. you have to call beforesubmit method for this let see one example

    $('#ReplayForm').ajaxForm({ 
             beforeSubmit : function(arr, $form, options){
                 if("condition is true")
                 {
                    return true; //it will continue your submission.
                 }
                 else
                 {
                                   return false; //ti will stop your submission.
                 }
    
              },
              success : function(data){
                  endLoading();
                  if(data.result=="success")            
                  {
                      showSuccessNotification(data.notification);
                  } 
                  else
                  {
                      showErrorNotification(data.notification);
                  }
               }
       });  
    

提交回复
热议问题