@@ -70,11 +70,15 @@ protected function _ajax($method, $url, $responseElement = '', $parameters = [])
7070 }
7171 $ this ->createAjaxParameters ($ ajaxParameters , $ parameters );
7272 $ retour .= "$.ajax({ " . $ this ->implodeAjaxParameters ($ ajaxParameters ) . "}).done(function( data, textStatus, jqXHR ) { \n" ;
73- $ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader , ($ historize ? $ originalSelector : null )) . "}); \n" ;
74-
73+ $ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader , ($ historize ? $ originalSelector : null )) . "}) " ;
74+ if (isset ($ error )) {
75+ $ retour .= '.fail(function( jqXHR, textStatus, errorThrown ){ ' . $ error . '}) ' ;
76+ }
77+ $ retour .= "; \n" ;
7578 $ retour = $ this ->_addJsCondition ($ jsCondition , $ retour );
76- if ($ immediatly )
79+ if ($ immediatly ) {
7780 $ this ->jquery_code_for_compile [] = $ retour ;
81+ }
7882 return $ retour ;
7983 }
8084
@@ -817,8 +821,11 @@ private function _postForm($url, $form, $responseElement, $parameters = []) {
817821 }
818822 $ this ->createAjaxParameters ($ ajaxParameters , $ parameters );
819823 $ retour .= "$.ajax({ " . $ this ->implodeAjaxParameters ($ ajaxParameters ) . "}).done(function( data ) { \n" ;
820- $ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader ) . "}); \n" ;
821-
824+ $ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader ) . "}) " ;
825+ if (isset ($ error )) {
826+ $ retour .= '.fail(function( jqXHR, textStatus, errorThrown ){ ' . $ error . '}) ' ;
827+ }
828+ $ retour .= "; \n" ;
822829 if ($ validation ) {
823830 $ retour = "$('#'+ " . $ form . ").validate({submitHandler: function(form) {
824831 " . $ retour . "
0 commit comments