@@ -352,7 +352,7 @@ public function jsonArrayOn($event,$element,$maskSelector, $url,$method="get",$p
352352
353353 /**
354354 * Prepares a Get ajax request
355- * To use on an event
355+ * for using on an event
356356 * @param string $url The url of the request
357357 * @param string $responseElement selector of the HTML element displaying the answer
358358 * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false)
@@ -365,8 +365,8 @@ public function getDeferred($url, $responseElement="", $parameters=[]) {
365365 /**
366366 * Performs a get to $url on the event $event on $element
367367 * and display it in $responseElement
368- * @param string $event
369- * @param string $element
368+ * @param string $event the event
369+ * @param string $element the element on which event is observed
370370 * @param string $url The url of the request
371371 * @param string $responseElement The selector of the HTML element displaying the answer
372372 * @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)
@@ -379,8 +379,8 @@ public function getOn($event, $element, $url, $responseElement="", $parameters=a
379379 /**
380380 * Performs an ajax request to $url on the event $event on $element
381381 * and display it in $responseElement
382- * @param string $event
383- * @param string $element
382+ * @param string $event the event observed
383+ * @param string $element the element on which event is observed
384384 * @param string $url The url of the request
385385 * @param string $responseElement The selector of the HTML element displaying the answer
386386 * @param array $parameters default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false)
@@ -393,7 +393,7 @@ public function ajaxOn($event, $element, $url, $responseElement="", $parameters=
393393 /**
394394 * Performs a get to $url on the click event on $element
395395 * and display it in $responseElement
396- * @param string $element
396+ * @param string $element the element on which event is observed
397397 * @param string $url The url of the request
398398 * @param string $responseElement The selector of the HTML element displaying the answer
399399 * @param array $parameters default : array("method"=>"get","preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false)
@@ -405,14 +405,50 @@ public function ajaxOnClick($element, $url, $responseElement="", $parameters=arr
405405 /**
406406 * Performs a get to $url on the click event on $element
407407 * and display it in $responseElement
408- * @param string $element
408+ * @param string $element the element on which click is observed
409409 * @param string $url The url of the request
410410 * @param string $responseElement The selector of the HTML element displaying the answer
411411 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false)
412412 */
413413 public function getOnClick ($ element , $ url , $ responseElement ="" , $ parameters =array ()) {
414414 return $ this ->getOn ("click " , $ element , $ url , $ responseElement , $ parameters );
415415 }
416+
417+ /**
418+ * Uses an hyperlink to make an ajax get request
419+ * @param string $element an hyperlink selector
420+ * @param string $responseElement the target of the ajax request (data-target attribute of the element is used if responseElement is omited)
421+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>true)
422+ * @return $this
423+ */
424+ public function getHref ($ element ,$ responseElement ="" ,$ parameters =array ()){
425+ $ parameters ["attr " ]="href " ;
426+ if (JString::isNull ($ responseElement )){
427+ $ responseElement ='$($(this).attr("data-target")) ' ;
428+ }
429+ if (!isset ($ parameters ["historize " ])){
430+ $ parameters ["historize " ]=true ;
431+ }
432+ return $ this ->getOnClick ($ element , "" ,$ responseElement ,$ parameters );
433+ }
434+
435+ /**
436+ * Uses an hyperlink to make an ajax get request
437+ * @param string $element an hyperlink selector
438+ * @param string $responseElement the target of the ajax request (data-target attribute of the element is used if responseElement is omited)
439+ * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"href","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","jsCondition"=>NULL,"headers"=>null,"historize"=>false)
440+ * @return $this
441+ */
442+ public function postHref ($ element ,$ responseElement ="" ,$ parameters =array ()){
443+ $ parameters ["attr " ]="href " ;
444+ if (JString::isNull ($ responseElement )){
445+ $ responseElement ='$($(this).attr("data-target")) ' ;
446+ }
447+ if (!isset ($ parameters ["historize " ])){
448+ $ parameters ["historize " ]=true ;
449+ }
450+ return $ this ->postOnClick ($ element , "" ,"{} " ,$ responseElement ,$ parameters );
451+ }
416452
417453 private function _post ($ url , $ params ="{} " ,$ responseElement ="" , $ parameters =[]) {
418454 $ parameters ["params " ]=$ params ;
0 commit comments