@@ -25,6 +25,7 @@ protected function _ajax($method,$url,$responseElement="",$parameters=[]) {
2525 $ immediatly =false ;
2626 $ jqueryDone ="html " ;
2727 $ ajaxTransition =null ;
28+ $ async =true ;
2829 $ params =null ;
2930 $ headers =null ;
3031 $ jsCondition =null ;
@@ -37,8 +38,8 @@ protected function _ajax($method,$url,$responseElement="",$parameters=[]) {
3738 if ($ hasLoader ===true && JString::isNotNull ($ responseElement )){
3839 $ this ->addLoading ($ retour , $ responseElement );
3940 }
40-
41- $ ajaxParameters =["url " =>"url " ,"method " =>"' " .\strtoupper ($ method )."' " ];
41+ $ async =( $ async )? " true " : " false " ;
42+ $ ajaxParameters =["url " =>"url " ,"method " =>"' " .\strtoupper ($ method )."' " , " async " => $ async ];
4243 if (isset ($ params )){
4344 $ ajaxParameters ["data " ]=self ::_correctParams ($ params );
4445 }
@@ -98,7 +99,7 @@ protected function _getAjaxUrl($url,$attr){
9899
99100 protected function _getOnAjaxDone ($ responseElement ,$ jqueryDone ,$ ajaxTransition ,$ jsCallback ){
100101 $ retour ="" ;$ call =null ;
101- if ($ responseElement!== "" ) {
102+ if (JString:: isNotNull ( $ responseElement) ) {
102103 if (isset ($ ajaxTransition )){
103104 $ call =$ this ->setAjaxDataCall ($ ajaxTransition );
104105 }elseif (isset ($ this ->ajaxTransition )){
@@ -114,7 +115,7 @@ protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$
114115 }
115116
116117 protected function _getResponseElement ($ responseElement ){
117- if ($ responseElement!== "" ) {
118+ if (JString:: isNotNull ( $ responseElement) ) {
118119 $ responseElement =Javascript::prep_value ($ responseElement );
119120 $ responseElement =Javascript::prep_jquery_selector ($ responseElement );
120121 }
@@ -500,8 +501,9 @@ public function postOnClick($element, $url, $params="{}", $responseElement="", $
500501 }
501502
502503 private function _postForm ($ url , $ form , $ responseElement , $ parameters =[]) {
503- $ params ="{} " ;$ validation =false ;$ jsCallback =NULL ;$ attr ="id " ;$ hasLoader =true ;$ jqueryDone ="html " ;$ ajaxTransition =null ;$ immediatly =false ;$ jsCondition =NULL ;$ headers =NULL ;
504+ $ params ="{} " ;$ validation =false ;$ jsCallback =NULL ;$ attr ="id " ;$ hasLoader =true ;$ jqueryDone ="html " ;$ ajaxTransition =null ;$ immediatly =false ;$ jsCondition =NULL ;$ headers =NULL ;$ async = true ;
504505 \extract ($ parameters );
506+ $ async =($ async )?"true " :"false " ;
505507 $ jsCallback =isset ($ jsCallback ) ? $ jsCallback : "" ;
506508 $ retour =$ this ->_getAjaxUrl ($ url , $ attr );
507509 $ retour .="\nvar params=$('# " .$ form ."').serialize(); \n" ;
@@ -513,7 +515,7 @@ private function _postForm($url, $form, $responseElement, $parameters=[]) {
513515 if ($ hasLoader ===true ){
514516 $ this ->addLoading ($ retour , $ responseElement );
515517 }
516- $ ajaxParameters =["url " =>"url " ,"method " =>"'POST' " ,"data " =>"params " ];
518+ $ ajaxParameters =["url " =>"url " ,"method " =>"'POST' " ,"data " =>"params " , " async " => $ async ];
517519 if (isset ($ headers )){
518520 $ ajaxParameters ["headers " ]=$ headers ;
519521 }
0 commit comments