33namespace Ajax \common \traits ;
44
55use Ajax \service \JArray ;
6+ use Ajax \JsUtils ;
67
78/**
89 * @author jc
9- * @property Ajax\ JsUtils $js
10+ * @property JsUtils $js
1011 */
1112trait JsUtilsAjaxTrait {
1213
@@ -21,9 +22,10 @@ public function setAjaxLoader($loader) {
2122 * @param string $responseElement selector of the HTML element displaying the answer
2223 * @param string $jsCallback javascript code to execute after the request
2324 * @param boolean $hasLoader true for showing ajax loader. default : true
25+ * @param string $jqueryDone the jquery function call on ajax data. default:html
2426 */
25- public function get ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ hasLoader =true ) {
26- return $ this ->js ->_get ($ url , $ params , $ responseElement , $ jsCallback , NULL , $ hasLoader ,true );
27+ public function get ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ hasLoader =true , $ jqueryDone = " html " ) {
28+ return $ this ->js ->_get ($ url , $ params , $ responseElement , $ jsCallback , NULL , $ hasLoader ,$ jqueryDone , true );
2729 }
2830
2931 /**
@@ -68,7 +70,7 @@ public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL
6870 * @param string $jsCallback javascript code to execute after the request
6971 */
7072 public function jsonArray ($ maskSelector , $ url , $ method ="get " , $ params ="{} " , $ jsCallback =NULL ) {
71- return $ this ->js ->_jsonArray ($ maskSelector , $ url , $ method , $ params , $ jsCallback , NULL , true );
73+ return $ this ->js ->_jsonArray ($ maskSelector , $ url , $ method , $ params , $ jsCallback , NULL ,true );
7274 }
7375
7476 /**
@@ -78,6 +80,7 @@ public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsC
7880 * @param string $params JSON parameters
7981 * @param string $method Method used
8082 * @param string $jsCallback javascript code to execute after the request
83+ * @param string $jqueryDone the jquery function call on ajax data. default:html
8184 */
8285 public function jsonArrayDeferred ($ maskSelector , $ url , $ method ="get " , $ params ="{} " , $ jsCallback =NULL ) {
8386 return $ this ->js ->_jsonArray ($ maskSelector , $ url , $ method , $ params , $ jsCallback , NULL , false );
@@ -102,9 +105,10 @@ public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=arra
102105 * @param string $responseElement selector of the HTML element displaying the answer
103106 * @param string $jsCallback javascript code to execute after the request
104107 * @param string $attr the html attribute added to the request
108+ * @param string $jqueryDone the jquery function call on ajax data. default:html
105109 */
106- public function getDeferred ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ attr ="id " ) {
107- return $ this ->js ->_get ($ url , $ params , $ responseElement , $ jsCallback , $ attr , false );
110+ public function getDeferred ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ attr ="id " , $ jqueryDone = " html " ) {
111+ return $ this ->js ->_get ($ url , $ params , $ responseElement , $ jsCallback , $ attr , false , $ jqueryDone );
108112 }
109113
110114 /**
@@ -114,7 +118,7 @@ public function getDeferred($url, $responseElement="", $params="{}", $jsCallback
114118 * @param string $element
115119 * @param string $url The url of the request
116120 * @param string $responseElement The selector of the HTML element displaying the answer
117- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
121+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
118122 */
119123 public function getOn ($ event , $ element , $ url , $ responseElement ="" , $ parameters =array ()) {
120124 $ params =JArray::getDefaultValue ($ parameters , "params " , "{} " );
@@ -127,7 +131,7 @@ public function getOn($event, $element, $url, $responseElement="", $parameters=a
127131 * @param string $element
128132 * @param string $url The url of the request
129133 * @param string $responseElement The selector of the HTML element displaying the answer
130- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
134+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
131135 */
132136 public function getOnClick ($ element , $ url , $ responseElement ="" , $ parameters =array ()) {
133137 return $ this ->getOn ("click " , $ element , $ url , $ responseElement , $ parameters );
@@ -140,9 +144,10 @@ public function getOnClick($element, $url, $responseElement="", $parameters=arra
140144 * @param string $responseElement selector of the HTML element displaying the answer
141145 * @param string $jsCallback javascript code to execute after the request
142146 * @param boolean $hasLoader true for showing ajax loader. default : true
147+ * @param string $jqueryDone the jquery function call on ajax data. default:html
143148 */
144- public function post ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ hasLoader =true ) {
145- return $ this ->js ->_post ($ url , $ params , $ responseElement , $ jsCallback , NULL , $ hasLoader ,true );
149+ public function post ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL ,$ hasLoader =true , $ jqueryDone = " html " ) {
150+ return $ this ->js ->_post ($ url , $ params , $ responseElement , $ jsCallback , NULL , $ hasLoader ,$ jqueryDone , true );
146151 }
147152
148153 /**
@@ -154,9 +159,10 @@ public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$
154159 * @param string $responseElement selector of the HTML element displaying the answer
155160 * @param string $jsCallback javascript code to execute after the request
156161 * @param boolean $hasLoader true for showing ajax loader. default : true
162+ * @param string $jqueryDone the jquery function call on ajax data. default:html
157163 */
158- public function postDeferred ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL , $ attr ="id " ,$ hasLoader =true ) {
159- return $ this ->js ->_post ($ url , $ params , $ responseElement , $ jsCallback , $ attr , $ hasLoader ,false );
164+ public function postDeferred ($ url , $ responseElement ="" , $ params ="{} " , $ jsCallback =NULL , $ attr ="id " ,$ hasLoader =true , $ jqueryDone = " html " ) {
165+ return $ this ->js ->_post ($ url , $ params , $ responseElement , $ jsCallback , $ attr , $ hasLoader ,$ jqueryDone , false );
160166 }
161167
162168 /**
@@ -167,7 +173,7 @@ public function postDeferred($url, $responseElement="", $params="{}", $jsCallbac
167173 * @param string $url The url of the request
168174 * @param string $params The parameters to send
169175 * @param string $responseElement selector of the HTML element displaying the answer
170- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
176+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
171177 */
172178 public function postOn ($ event , $ element , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
173179 return $ this ->js ->_postOn ($ event , $ element , $ url , $ params , $ responseElement , $ parameters );
@@ -180,7 +186,7 @@ public function postOn($event, $element, $url, $params="{}", $responseElement=""
180186 * @param string $url The url of the request
181187 * @param string $params The parameters to send
182188 * @param string $responseElement selector of the HTML element displaying the answer
183- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
189+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
184190 */
185191 public function postOnClick ($ element , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
186192 return $ this ->postOn ("click " , $ element , $ url , $ params , $ responseElement , $ parameters );
@@ -193,9 +199,10 @@ public function postOnClick($element, $url, $params="{}", $responseElement="", $
193199 * @param string $responseElement selector of the HTML element displaying the answer
194200 * @param string $jsCallback javascript code to execute after the request
195201 * @param boolean $hasLoader true for showing ajax loader. default : true
202+ * @param string $jqueryDone the jquery function call on ajax data. default:html
196203 */
197- public function postForm ($ url , $ form , $ responseElement , $ validation =false , $ jsCallback =NULL ,$ hasLoader =true ) {
198- return $ this ->js ->_postForm ($ url , $ form , $ responseElement , $ validation , $ jsCallback , NULL , $ hasLoader ,true );
204+ public function postForm ($ url , $ form , $ responseElement , $ validation =false , $ jsCallback =NULL ,$ hasLoader =true , $ jqueryDone = " html " ) {
205+ return $ this ->js ->_postForm ($ url , $ form , $ responseElement , $ validation , $ jsCallback , NULL , $ hasLoader ,$ jqueryDone , true );
199206 }
200207
201208 /**
@@ -207,9 +214,10 @@ public function postForm($url, $form, $responseElement, $validation=false, $jsCa
207214 * @param string $jsCallback javascript code to execute after the request
208215 * @param string $attr the html attribute added to the request
209216 * @param boolean $hasLoader true for showing ajax loader. default : true
217+ * @param string $jqueryDone the jquery function call on ajax data. default:html
210218 */
211- public function postFormDeferred ($ url , $ form , $ responseElement , $ validation =false , $ jsCallback =NULL ,$ attr ="id " ,$ hasLoader =true ) {
212- return $ this ->js ->_postForm ($ url , $ form , $ responseElement , $ validation , $ jsCallback , $ attr , $ hasLoader ,false );
219+ public function postFormDeferred ($ url , $ form , $ responseElement , $ validation =false , $ jsCallback =NULL ,$ attr ="id " ,$ hasLoader =true , $ jqueryDone = " html " ) {
220+ return $ this ->js ->_postForm ($ url , $ form , $ responseElement , $ validation , $ jsCallback , $ attr , $ hasLoader ,$ jqueryDone , false );
213221 }
214222
215223 /**
@@ -220,7 +228,7 @@ public function postFormDeferred($url, $form, $responseElement, $validation=fals
220228 * @param string $url
221229 * @param string $form
222230 * @param string $responseElement selector of the HTML element displaying the answer
223- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
231+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
224232 */
225233 public function postFormOn ($ event , $ element , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
226234 return $ this ->js ->_postFormOn ($ event ,$ element , $ url , $ form , $ responseElement , $ parameters );
@@ -233,7 +241,7 @@ public function postFormOn($event, $element, $url, $form, $responseElement="", $
233241 * @param string $url
234242 * @param string $form
235243 * @param string $responseElement selector of the HTML element displaying the answer
236- * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
244+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html" )
237245 */
238246 public function postFormOnClick ($ element , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
239247 return $ this ->postFormOn ("click " , $ element , $ url , $ form , $ responseElement , $ parameters );
0 commit comments