jquery - Overriding existing code for AJAX form handling -


the following code taking effect on pages, ajaxing form submissions.

there default behaviour handling successful response.

my question how can override default behaviour without modifying code? still want ajax submission , validation want different on successful response.

$('form').each(formhandler);  function formhandler(){     $(this).validate({         submithandler : function(e){             var $form = $(this.currentform),                 ajaxevent = $.event("submitstart"),                 successevent = $.event("submitsuccess"),                 errorevent = $.event("submiterror");              $form.trigger(ajaxevent);              if (!ajaxevent.isdefaultprevented()) {                 $.ajax({                     type: 'post',                     datatype: 'json',                     url: $form.attr('action'),                     data: $form.serialize(),                     complete: function(ajax){  },                     success : function(response, result, ajax){                         if (result == 'success' && response && 'result' in response && response.result.tolowercase() == 'success') {                             $form.trigger(successevent);                             if (!successevent.isdefaultprevented()) {                                 // default behaviour here                             } 


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -