@@ -116,12 +116,12 @@ protected function _eventsOnCreate(JsUtils $js=NULL){
116116 }
117117
118118 /**
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
125125 */
126126 public function _ajaxOn ($ operation , $ event , $ url , $ responseElement ="" , $ parameters =array ()) {
127127 $ params =array ("url " => $ url ,"responseElement " => $ responseElement );
@@ -130,14 +130,41 @@ public function _ajaxOn($operation, $event, $url, $responseElement="", $paramete
130130 return $ this ;
131131 }
132132
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+ **/
133142 public function getOn ($ event , $ url , $ responseElement ="" , $ parameters =array ()) {
134143 return $ this ->_ajaxOn ("get " , $ event , $ url , $ responseElement , $ parameters );
135144 }
136145
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+ **/
137154 public function getOnClick ($ url , $ responseElement ="" , $ parameters =array ()) {
138155 return $ this ->getOn ("click " , $ url , $ responseElement , $ parameters );
139156 }
140157
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+ **/
141168 public function postOn ($ event , $ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
142169 $ allParameters =[];
143170 if (isset ($ parameters ["params " ])){
@@ -149,16 +176,42 @@ public function postOn($event, $url, $params="{}", $responseElement="", $paramet
149176 $ parameters ["params " ]=\implode ("+'&'+ " , $ allParameters );
150177 return $ this ->_ajaxOn ("post " , $ event , $ url , $ responseElement , $ parameters );
151178 }
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+ **/
153189 public function postOnClick ($ url , $ params ="{} " , $ responseElement ="" , $ parameters =array ()) {
154190 return $ this ->postOn ("click " , $ url , $ params , $ responseElement , $ parameters );
155191 }
156192
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+ */
157202 public function postFormOn ($ event , $ url , $ form , $ responseElement ="" , $ parameters =array ()) {
158203 $ parameters ["form " ]=$ form ;
159204 return $ this ->_ajaxOn ("postForm " , $ event , $ url , $ responseElement , $ parameters );
160205 }
161206
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+ */
162215 public function postFormOnClick ($ url , $ form , $ responseElement ="" , $ parameters =array ()) {
163216 return $ this ->postFormOn ("click " , $ url , $ form , $ responseElement , $ parameters );
164217 }
0 commit comments