@@ -54,9 +54,14 @@ protected function _ajax($method, $url, $responseElement = "", $parameters = [])
54
54
if (isset ($ headers )) {
55
55
$ ajaxParameters ["headers " ] = $ headers ;
56
56
}
57
+ if (isset ($ partial )) {
58
+ $ ajaxParameters ["xhr " ] = "xhrProvider " ;
59
+ $ retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText; " . $ partial . ";}; }; " ;
60
+ }
57
61
$ this ->createAjaxParameters ($ ajaxParameters , $ parameters );
58
62
$ retour .= "$.ajax({ " . $ this ->implodeAjaxParameters ($ ajaxParameters ) . "}).done(function( data, textStatus, jqXHR ) { \n" ;
59
63
$ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader , ($ historize ? $ originalSelector : null )) . "}); \n" ;
64
+
60
65
$ retour = $ this ->_addJsCondition ($ jsCondition , $ retour );
61
66
if ($ immediatly )
62
67
$ this ->jquery_code_for_compile [] = $ retour ;
@@ -735,6 +740,10 @@ private function _postForm($url, $form, $responseElement, $parameters = []) {
735
740
if (isset ($ headers )) {
736
741
$ ajaxParameters ["headers " ] = $ headers ;
737
742
}
743
+ if (isset ($ partial )) {
744
+ $ ajaxParameters ["xhr " ] = "xhrProvider " ;
745
+ $ retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText; " . $ partial . ";}; }; " ;
746
+ }
738
747
$ this ->createAjaxParameters ($ ajaxParameters , $ parameters );
739
748
$ retour .= "$.ajax({ " . $ this ->implodeAjaxParameters ($ ajaxParameters ) . "}).done(function( data ) { \n" ;
740
749
$ retour .= $ this ->_getOnAjaxDone ($ responseElement , $ jqueryDone , $ ajaxTransition , $ jsCallback , $ hasLoader ) . "}); \n" ;
0 commit comments