@@ -116,12 +116,12 @@ protected function _eventsOnCreate(JsUtils $js=NULL){
116
116
}
117
117
118
118
/**
119
- * @param string $operation
120
- * @param string $event
121
- * @param string $url
122
- * @param string $responseElement
123
- * @param array $parameters
124
- * @return BaseHtml
119
+ * @param string $operation http method get, post, postForm or json
120
+ * @param string $event the event that triggers the request
121
+ * @param string $url The url of the request
122
+ * @param string $responseElement The selector of the HTML element displaying the answer
123
+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false)
124
+ * @return $this
125
125
*/
126
126
public function _ajaxOn ($ operation , $ event , $ url , $ responseElement ="" , $ parameters =array ()) {
127
127
$ params =array ("url " => $ url ,"responseElement " => $ responseElement );
@@ -130,14 +130,41 @@ public function _ajaxOn($operation, $event, $url, $responseElement="", $paramete
130
130
return $ this ;
131
131
}
132
132
133
+ /**
134
+ * Performs a get to $url on the event $event on $element
135
+ * and display it in $responseElement
136
+ * @param string $event the event that triggers the get request
137
+ * @param string $url The url of the request
138
+ * @param string $responseElement The selector of the HTML element displaying the answer
139
+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false)
140
+ * @return $this
141
+ **/
133
142
public function getOn ($ event , $ url , $ responseElement ="" , $ parameters =array ()) {
134
143
return $ this ->_ajaxOn ("get " , $ event , $ url , $ responseElement , $ parameters );
135
144
}
136
145
146
+ /**
147
+ * Performs a get to $url on the click event on $element
148
+ * and display it in $responseElement
149
+ * @param string $url The url of the request
150
+ * @param string $responseElement The selector of the HTML element displaying the answer
151
+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false)
152
+ * @return $this
153
+ **/
137
154
public function getOnClick ($ url , $ responseElement ="" , $ parameters =array ()) {
138
155
return $ this ->getOn ("click " , $ url , $ responseElement , $ parameters );
139
156
}
140
157
158
+ /**
159
+ * Performs a post to $url on the event $event on $element
160
+ * and display it in $responseElement
161
+ * @param string $event the event that triggers the post request
162
+ * @param string $url The url of the request
163
+ * @param string $params the request parameters in JSON format
164
+ * @param string $responseElement The selector of the HTML element displaying the answer
165
+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false)
166
+ * @return $this
167
+ **/
141
168
public function postOn ($ event , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
142
169
$ allParameters =[];
143
170
if (isset ($ parameters ["params " ])){
@@ -149,16 +176,42 @@ public function postOn($event, $url, $params="{}", $responseElement="", $paramet
149
176
$ parameters ["params " ]=\implode ("+'&'+ " , $ allParameters );
150
177
return $ this ->_ajaxOn ("post " , $ event , $ url , $ responseElement , $ parameters );
151
178
}
152
-
179
+
180
+ /**
181
+ * Performs a post to $url on the click event on $element
182
+ * and display it in $responseElement
183
+ * @param string $url The url of the request
184
+ * @param string $params the request parameters in JSON format
185
+ * @param string $responseElement The selector of the HTML element displaying the answer
186
+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false)
187
+ * @return $this
188
+ **/
153
189
public function postOnClick ($ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
154
190
return $ this ->postOn ("click " , $ url , $ params , $ responseElement , $ parameters );
155
191
}
156
192
193
+ /**
194
+ * Performs a post form with ajax
195
+ * @param string $event the event that triggers the post request
196
+ * @param string $url The url of the request
197
+ * @param string $form The form HTML id
198
+ * @param string $responseElement selector of the HTML element displaying the answer
199
+ * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false)
200
+ * @return $this
201
+ */
157
202
public function postFormOn ($ event , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
158
203
$ parameters ["form " ]=$ form ;
159
204
return $ this ->_ajaxOn ("postForm " , $ event , $ url , $ responseElement , $ parameters );
160
205
}
161
206
207
+ /**
208
+ * Performs a post form with ajax on click
209
+ * @param string $url The url of the request
210
+ * @param string $form The form HTML id
211
+ * @param string $responseElement selector of the HTML element displaying the answer
212
+ * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false)
213
+ * @return $this
214
+ */
162
215
public function postFormOnClick ($ url , $ form , $ responseElement ="" , $ parameters =array ()) {
163
216
return $ this ->postFormOn ("click " , $ url , $ form , $ responseElement , $ parameters );
164
217
}
0 commit comments