且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在通过.ajaxForm()提交表单之前执行某些操作?

更新时间:2023-09-18 23:49:40

是的,你肯定可以处理这种情况。你必须先调用beforesubmit方法,看一个例子

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);
              }
           }
   });