3
3
namespace Ajax \common \traits ;
4
4
5
5
use Ajax \service \JArray ;
6
+ use Ajax \JsUtils ;
6
7
7
8
/**
8
9
* @author jc
9
- * @property Ajax\ JsUtils $js
10
+ * @property JsUtils $js
10
11
*/
11
12
trait JsUtilsAjaxTrait {
12
13
@@ -21,9 +22,10 @@ public function setAjaxLoader($loader) {
21
22
* @param string $responseElement selector of the HTML element displaying the answer
22
23
* @param string $jsCallback javascript code to execute after the request
23
24
* @param boolean $hasLoader true for showing ajax loader. default : true
25
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
24
26
*/
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 );
27
29
}
28
30
29
31
/**
@@ -68,7 +70,7 @@ public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL
68
70
* @param string $jsCallback javascript code to execute after the request
69
71
*/
70
72
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 );
72
74
}
73
75
74
76
/**
@@ -78,6 +80,7 @@ public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsC
78
80
* @param string $params JSON parameters
79
81
* @param string $method Method used
80
82
* @param string $jsCallback javascript code to execute after the request
83
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
81
84
*/
82
85
public function jsonArrayDeferred ($ maskSelector , $ url , $ method ="get " , $ params ="{} " , $ jsCallback =NULL ) {
83
86
return $ this ->js ->_jsonArray ($ maskSelector , $ url , $ method , $ params , $ jsCallback , NULL , false );
@@ -102,9 +105,10 @@ public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=arra
102
105
* @param string $responseElement selector of the HTML element displaying the answer
103
106
* @param string $jsCallback javascript code to execute after the request
104
107
* @param string $attr the html attribute added to the request
108
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
105
109
*/
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 );
108
112
}
109
113
110
114
/**
@@ -114,7 +118,7 @@ public function getDeferred($url, $responseElement="", $params="{}", $jsCallback
114
118
* @param string $element
115
119
* @param string $url The url of the request
116
120
* @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" )
118
122
*/
119
123
public function getOn ($ event , $ element , $ url , $ responseElement ="" , $ parameters =array ()) {
120
124
$ params =JArray::getDefaultValue ($ parameters , "params " , "{} " );
@@ -127,7 +131,7 @@ public function getOn($event, $element, $url, $responseElement="", $parameters=a
127
131
* @param string $element
128
132
* @param string $url The url of the request
129
133
* @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" )
131
135
*/
132
136
public function getOnClick ($ element , $ url , $ responseElement ="" , $ parameters =array ()) {
133
137
return $ this ->getOn ("click " , $ element , $ url , $ responseElement , $ parameters );
@@ -140,9 +144,10 @@ public function getOnClick($element, $url, $responseElement="", $parameters=arra
140
144
* @param string $responseElement selector of the HTML element displaying the answer
141
145
* @param string $jsCallback javascript code to execute after the request
142
146
* @param boolean $hasLoader true for showing ajax loader. default : true
147
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
143
148
*/
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 );
146
151
}
147
152
148
153
/**
@@ -154,9 +159,10 @@ public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$
154
159
* @param string $responseElement selector of the HTML element displaying the answer
155
160
* @param string $jsCallback javascript code to execute after the request
156
161
* @param boolean $hasLoader true for showing ajax loader. default : true
162
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
157
163
*/
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 );
160
166
}
161
167
162
168
/**
@@ -167,7 +173,7 @@ public function postDeferred($url, $responseElement="", $params="{}", $jsCallbac
167
173
* @param string $url The url of the request
168
174
* @param string $params The parameters to send
169
175
* @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" )
171
177
*/
172
178
public function postOn ($ event , $ element , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
173
179
return $ this ->js ->_postOn ($ event , $ element , $ url , $ params , $ responseElement , $ parameters );
@@ -180,7 +186,7 @@ public function postOn($event, $element, $url, $params="{}", $responseElement=""
180
186
* @param string $url The url of the request
181
187
* @param string $params The parameters to send
182
188
* @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" )
184
190
*/
185
191
public function postOnClick ($ element , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
186
192
return $ this ->postOn ("click " , $ element , $ url , $ params , $ responseElement , $ parameters );
@@ -193,9 +199,10 @@ public function postOnClick($element, $url, $params="{}", $responseElement="", $
193
199
* @param string $responseElement selector of the HTML element displaying the answer
194
200
* @param string $jsCallback javascript code to execute after the request
195
201
* @param boolean $hasLoader true for showing ajax loader. default : true
202
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
196
203
*/
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 );
199
206
}
200
207
201
208
/**
@@ -207,9 +214,10 @@ public function postForm($url, $form, $responseElement, $validation=false, $jsCa
207
214
* @param string $jsCallback javascript code to execute after the request
208
215
* @param string $attr the html attribute added to the request
209
216
* @param boolean $hasLoader true for showing ajax loader. default : true
217
+ * @param string $jqueryDone the jquery function call on ajax data. default:html
210
218
*/
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 );
213
221
}
214
222
215
223
/**
@@ -220,7 +228,7 @@ public function postFormDeferred($url, $form, $responseElement, $validation=fals
220
228
* @param string $url
221
229
* @param string $form
222
230
* @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" )
224
232
*/
225
233
public function postFormOn ($ event , $ element , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
226
234
return $ this ->js ->_postFormOn ($ event ,$ element , $ url , $ form , $ responseElement , $ parameters );
@@ -233,7 +241,7 @@ public function postFormOn($event, $element, $url, $form, $responseElement="", $
233
241
* @param string $url
234
242
* @param string $form
235
243
* @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" )
237
245
*/
238
246
public function postFormOnClick ($ element , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
239
247
return $ this ->postFormOn ("click " , $ element , $ url , $ form , $ responseElement , $ parameters );
0 commit comments