18 protected $ajaxLoader =
"<div class=\"ui active centered inline text loader\">Loading</div>";
20 abstract public function getUrl($url);
22 abstract public function _add_event($element, $js, $event, $preventDefault =
false, $stopPropagation =
false, $immediatly =
true, $listenerOn =
false);
24 abstract public function interval($jsCode, $time, $globalName =
null, $immediatly =
true);
26 protected function _ajax($method, $url, $responseElement =
'', $parameters = []) {
27 if (isset($this->params[
'ajax'])) {
28 extract($this->params[
'ajax']);
32 $jsCallback = isset($jsCallback) ? $jsCallback :
'';
34 $originalSelector = $responseElement;
36 $retour .=
"let self=this;\n";
37 $before = isset($before) ? $before :
"";
39 if ($hasLoader ===
true && JString::isNotNull($responseElement)) {
41 } elseif ($hasLoader ===
'response') {
43 } elseif ($hasLoader ===
'internal-x') {
45 } elseif ($hasLoader ===
'internal') {
46 $retour .=
"\n$(this).addClass('loading');";
47 } elseif (\is_string($hasLoader)) {
52 "method" =>
"'" . \strtoupper($method) .
"'"
55 $ajaxParameters[
"async"] = ($async ?
"true" :
"false");
60 if (isset($headers)) {
61 $ajaxParameters[
"headers"] = $headers;
64 $csrf = (is_string($csrf)) ? $csrf :
'csrf-token';
65 $parameters[
"beforeSend"] =
"jqXHR.setRequestHeader('{$csrf}', $('meta[name=\"{$csrf}\"]').attr('content'));";
67 if (isset($partial)) {
68 $ajaxParameters[
"xhr"] =
"xhrProvider";
69 $retour .=
"let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial .
";}; };";
70 } elseif (isset($upload)) {
71 $ajaxParameters[
"xhr"] =
"xhrProvider";
72 $retour .=
'let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.upload.addEventListener("progress", function(event) {if (event.lengthComputable) {' . $upload .
'}}, false);';
75 $retour .=
"$.ajax({" . $this->
implodeAjaxParameters($ajaxParameters) .
"}).done(function( data, textStatus, jqXHR ) {\n";
76 $retour .= $this->
_getOnAjaxDone($responseElement, $jqueryDone,
$ajaxTransition, $jsCallback, ($historize ? $originalSelector :
null)) .
"})";
78 $retour .=
'.fail(function( jqXHR, textStatus, errorThrown ){' . $error .
'})';
80 $retour .=
'.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {' . ($always ??
'') . $this->
removeLoader($hasLoader) .
'})';
84 $this->jquery_code_for_compile[] = $retour;
91 "contentType" =>
"%value%",
92 "dataType" =>
"'%value%'",
93 "beforeSend" =>
"function(jqXHR,settings){%value%}",
94 "complete" =>
"function(jqXHR){%value%}",
95 "processData" =>
"%value%"
97 foreach ($validParameters as $param => $mask) {
98 if (isset($parameters[$param])) {
99 $original[$param] = \str_replace(
"%value%", $parameters[$param], $mask);
106 foreach ($ajaxParameters as $k => $v) {
120 if (isset($jsCondition)) {
121 return "if(" . $jsCondition .
"){\n" . $jsSource .
"\n}";
128 $retour =
"let url='" . $url .
"';";
130 if (JString::endswith($url,
"/") ===
true) {
134 if (JString::isNotNull($attr)) {
135 if ($attr ===
"value") {
136 $retour .=
"url=url+'" . $slash .
"'+$(this).val();\n";
137 } elseif ($attr ===
"html") {
138 $retour .=
"url=url+'" . $slash .
"'+$(this).html();\n";
139 } elseif (\substr($attr, 0, 3) ===
"js:") {
140 $retour .=
"url=url+'" . $slash .
"'+" . \substr($attr, 3) .
";\n";
141 } elseif ($attr !==
null && $attr !==
"") {
142 $retour .=
"let elmUrl=$(this).attr('" . $attr .
"')||'';";
143 $retour .=
"url=!(new RegExp('^((http|https|ftp):\/\/)')).test(elmUrl)?url+'" . $slash .
"'+elmUrl:elmUrl;\n";
150 return "window.onpopstate = function(e){if(e.state){let target=e.state.jqueryDone;$(e.state.selector)[target](e.state.html);}};";
154 $result =
"\nif (typeof getHref !== 'function'){function getHref(url) { return \$('a').filter(function(){return \$(this).prop('href') == url; });}}";
155 $result .=
"\nlet myurl={$previousURL};if(window._previousURL) getHref(window._previousURL).removeClass('active');getHref(myurl).addClass('active');window._previousURL=myurl;";
162 if (JString::isNotNull($responseElement)) {
165 } elseif (isset($this->ajaxTransition)) {
168 if (\is_callable($call))
169 $retour =
"\t" . $call($responseElement, $jqueryDone) .
";\n";
171 $retour =
"\t{$responseElement}.{$jqueryDone}( data );\n";
173 if (isset($history)) {
174 if ($this->params[
"autoActiveLinks"]) {
177 $retour .=
"\nwindow.history.pushState({'html':data,'selector':" . Javascript::prep_value($history) .
",'jqueryDone':'{$jqueryDone}'},'', url);";
179 $retour .=
"\t" . $jsCallback .
"\n";
184 if ($hasLoader ===
true) {
185 return "\n$('body').find('.ajax-loader').remove();";
187 if ($hasLoader ===
'internal') {
188 return "\n$(self).removeClass('loading');";
190 if ($hasLoader ===
'internal-x') {
191 return "\n$(self).children('.ajax-loader').remove();";
193 return "\n$('body').find('.loading').removeClass('loading');";
197 if (JString::isNotNull($responseElement)) {
198 $responseElement = Javascript::prep_jquery_selector($responseElement);
200 return $responseElement;
204 if (JString::isNotNull($formElement)) {
205 $formElement = Javascript::prep_value($formElement);
211 if ($url !==
"/" && JString::endsWith($url,
"/") ===
true)
212 $url = substr($url, 0, strlen($url) - 1);
213 if (strncmp($url,
'http://', 7) != 0 && strncmp($url,
'https://', 8) != 0) {
214 $url = $this->
getUrl($url);
220 if (JString::isNull($params)) {
223 if (\preg_match(
"@^\{.*?\}$@", $params)) {
224 if (! isset($ajaxParameters[
'contentType']) || ! JString::contains($ajaxParameters[
'contentType'],
'json')) {
225 return '$.param(' . $params .
')';
227 return 'JSON.stringify(' . $params .
')';
235 foreach ($parameters as $params) {
239 return \implode(
"+'&'+", $allParameters);
246 $loading_notifier =
'<div class="ajax-loader ui active inverted dimmer">' .
$ajaxLoader .
'</div>';
247 $retour .=
"\t\t{$responseElement}.append('{$loading_notifier}');\n";
254 $loading_notifier =
'<div class="ajax-loader">' .
$ajaxLoader .
'</div>';
255 $retour .=
"{$responseElement}.empty();\n";
256 $retour .=
"\t\t{$responseElement}.prepend('{$loading_notifier}');\n";
261 if (! \is_callable($params)) {
262 $result =
function ($responseElement, $jqueryDone =
'html') use ($params) {
270 foreach ($default as $k => $v) {
271 if (! isset($parameters[$k]))
272 $parameters[$k] = $v;
277 $this->ajaxLoader = $loader;
288 private function _get($url, $responseElement =
'', $parameters = []) {
289 return $this->
_ajax(
'get', $url, $responseElement, $parameters);
302 public function get($url, $responseElement =
'', $parameters = []) {
303 $parameters[
'immediatly'] =
true;
304 return $this->
_get($url, $responseElement, $parameters);
319 public function ajax($method, $url, $responseElement =
'', $parameters = []) {
320 $parameters[
'immediatly'] =
true;
321 return $this->
_ajax($method, $url, $responseElement, $parameters);
342 public function ajaxInterval($method, $url, $interval, $globalName =
null, $responseElement =
'', $parameters = [], $immediatly =
true) {
343 return $this->
interval($this->
ajaxDeferred($method, $url, $responseElement, $parameters), $interval, $globalName, $immediatly);
358 public function ajaxDeferred($method, $url, $responseElement =
'', $parameters = []) {
359 $parameters[
'immediatly'] =
false;
360 return $this->
_ajax($method, $url, $responseElement, $parameters);
373 private function _json($url, $method =
"get", $parameters = []) {
374 $parameters = \array_merge($parameters, [
377 $jsCallback = isset($parameters[
'jsCallback']) ? $parameters[
'jsCallback'] :
"";
378 $context = isset($parameters[
'context']) ? $parameters[
'context'] :
"document";
379 $retour =
"\tdata=($.isPlainObject(data))?data:JSON.parse(data);\t" . $jsCallback .
";" .
"\n\tfor(var key in data){" .
"if($('#'+key," . $context .
").length){ if($('#'+key," . $context .
").is('[value]')) { $('#'+key," . $context .
").val(data[key]);} else { $('#'+key," . $context .
").html(data[key]); }}};\n";
380 $retour .=
"\t$(document).trigger('jsonReady',[data]);\n";
381 $parameters[
"jsCallback"] = $retour;
382 return $this->
_ajax($method, $url,
null, $parameters);
395 public function json($url, $method =
"get", $parameters = []) {
396 return $this->
_json($url, $method, $parameters);
411 public function jsonOn($event, $element, $url, $method =
'get', $parameters = array()) {
413 'preventDefault' =>
true,
414 'stopPropagation' =>
true,
415 'immediatly' =>
true,
416 'listenerOn' =>
false
418 return $this->
_add_event($element, $this->
jsonDeferred($url, $method, $parameters), $event, $parameters[
"preventDefault"], $parameters[
"stopPropagation"], $parameters[
"immediatly"], $parameters[
'listenerOn']);
431 public function jsonDeferred($url, $method =
'get', $parameters = []) {
432 $parameters[
'immediatly'] =
false;
433 return $this->
_json($url, $method, $parameters);
447 private function _jsonArray($maskSelector, $url, $method =
'get', $parameters = []) {
448 $parameters = \array_merge($parameters, [
451 $rowClass = isset($parameters[
'rowClass']) ? $parameters[
'rowClass'] :
"_json";
452 $jsCallback = isset($parameters[
'jsCallback']) ? $parameters[
'jsCallback'] :
"";
453 $context = isset($parameters[
'context']) ? $parameters[
'context'] :
null;
454 if ($context ===
null) {
455 $parent =
"$('" . $maskSelector .
"').parent()";
456 $newElm =
"$('#'+newId)";
459 $newElm = $context .
".find('#'+newId)";
461 $appendTo =
"\t\tnewElm.appendTo(" . $parent .
");\n";
462 $retour = $parent .
".find('.{$rowClass}').remove();";
463 $retour .=
"\tdata=($.isPlainObject(data)||$.isArray(data))?data:JSON.parse(data);\n$.each(data, function(index, value) {\n" .
"\tlet created=false;let maskElm=$('" . $maskSelector .
"').first();maskElm.hide();" .
"\tlet newId=(maskElm.attr('id') || 'mask')+'-'+index;" .
"\tlet newElm=" . $newElm .
";\n" .
"\tif(!newElm.length){\n" .
"\t\tnewElm=maskElm.clone();
464 newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ let newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
465 $retour .= $appendTo;
466 $retour .=
"\t}\n" .
"\tfor(var key in value){\n" .
"\t\t\tlet html = $('<div />').append($(newElm).clone()).html();\n" .
"\t\t\tif(html.indexOf('__'+key+'__')>-1){\n" .
"\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n" .
"\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n" .
"\t\t\t}\n" .
"\t\tlet sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n" .
"\t\t\tlet selElm=$(sel,newElm);\n" .
"\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n" .
"\t\t}\n" .
"}\n" .
"\t$(newElm).show(true);" .
"\n" .
"\t$(newElm).removeClass('hide');" .
"});\n";
467 $retour .=
"\t$(document).trigger('jsonReady',[data]);\n";
468 $retour .=
"\t" . $jsCallback;
469 $parameters[
"jsCallback"] = $retour;
470 return $this->
_ajax($method, $url,
null, $parameters);
484 public function jsonArray($maskSelector, $url, $method =
'get', $parameters = []) {
485 return $this->
_jsonArray($maskSelector, $url, $method, $parameters);
500 $parameters[
'immediatly'] =
false;
501 return $this->
jsonArray($maskSelector, $url, $method, $parameters);
516 public function jsonArrayOn($event, $element, $maskSelector, $url, $method =
'get', $parameters = array()) {
518 'preventDefault' =>
true,
519 'stopPropagation' =>
true,
520 'immediatly' =>
true,
521 'listenerOn' =>
false
523 return $this->
_add_event($element, $this->
jsonArrayDeferred($maskSelector, $url, $method, $parameters), $event, $parameters[
"preventDefault"], $parameters[
"stopPropagation"], $parameters[
"immediatly"], $parameters[
'listenerOn']);
537 public function getDeferred($url, $responseElement =
"", $parameters = []) {
538 $parameters[
'immediatly'] =
false;
539 return $this->
_get($url, $responseElement, $parameters);
557 public function getOn($event, $element, $url, $responseElement =
"", $parameters = array()) {
558 $parameters[
'method'] =
'get';
559 return $this->
ajaxOn($event, $element, $url, $responseElement, $parameters);
577 public function ajaxOn($event, $element, $url, $responseElement =
'', $parameters = array()) {
579 'preventDefault' =>
true,
580 'stopPropagation' =>
true,
581 'immediatly' =>
true,
583 'listenerOn' =>
false
585 return $this->
_add_event($element, $this->
ajaxDeferred($parameters[
'method'], $url, $responseElement, $parameters), $event, $parameters[
"preventDefault"], $parameters[
"stopPropagation"], $parameters[
"immediatly"], $parameters[
'listenerOn']);
601 public function ajaxOnClick($element, $url, $responseElement =
'', $parameters = array()) {
602 return $this->
ajaxOn(
'click', $element, $url, $responseElement, $parameters);
618 public function getOnClick($element, $url, $responseElement =
'', $parameters = array()) {
619 return $this->
getOn(
'click', $element, $url, $responseElement, $parameters);
633 public function getHref($element, $responseElement =
"", $parameters = array()) {
634 $parameters[
'attr'] =
'href';
635 if (JString::isNull($responseElement)) {
636 $responseElement =
'%$(self).attr("data-target")%';
638 $responseElement =
'%$(self).attr("data-target") || "' . $responseElement .
'"%';
640 if (! isset($parameters[
'historize'])) {
641 $parameters[
'historize'] =
true;
643 if (! isset($parameters[
'jsCallback'])) {
644 $parameters[
'jsCallback'] =
'let event = jQuery.Event( "getHref" );event.url = url;$(self).trigger(event);';
646 return $this->
getOnClick($element,
"", $responseElement, $parameters);
660 public function postHref($element, $responseElement =
"", $parameters = array()) {
661 $parameters[
'attr'] =
'href';
662 if (JString::isNull($responseElement)) {
663 $responseElement =
'%$(this).attr("data-target")%';
665 $responseElement =
'%$(self).attr("data-target") || "' . $responseElement .
'"%';
667 if (! isset($parameters[
'historize'])) {
668 $parameters[
'historize'] =
true;
670 return $this->
postOnClick($element,
'',
'{}', $responseElement, $parameters);
684 public function postFormAction($element, $responseElement =
"", $parameters = array()) {
685 $parameters[
'attr'] =
'action';
686 if (JString::isNull($responseElement)) {
687 $responseElement =
'%$(self).attr("data-target")%';
689 $responseElement =
'%$(self).attr("data-target") || "' . $responseElement .
'"%';
691 $formId =
'%$(this).attr("id")%';
692 if (! isset($parameters[
'historize'])) {
693 $parameters[
'historize'] =
true;
695 $parameters[
'preventDefault'] =
true;
696 if (! isset($parameters[
'hasLoader'])) {
697 $parameters[
'hasLoader'] =
'$(self).find("button, input[type=submit], input[type=button]")';
699 if (! isset($parameters[
'jsCallback'])) {
700 $parameters[
'jsCallback'] =
'let event = jQuery.Event( "postFormAction" );event.params = Object.fromEntries(new URLSearchParams(params));$(self).trigger(event);';
702 return $this->
postFormOn(
'submit', $element,
'', $formId, $responseElement, $parameters);
705 private function _post($url, $params =
'{}', $responseElement =
'', $parameters = []) {
706 $parameters[
'params'] = $params;
707 return $this->
_ajax(
'POST', $url, $responseElement, $parameters);
722 public function post($url, $params =
"{}", $responseElement =
"", $parameters = []) {
723 $parameters[
'immediatly'] =
true;
724 return $this->
_post($url, $params, $responseElement, $parameters);
740 public function postDeferred($url, $params =
"{}", $responseElement =
"", $parameters = []) {
741 $parameters[
'immediatly'] =
false;
742 return $this->
_post($url, $params, $responseElement, $parameters);
760 public function postOn($event, $element, $url, $params =
"{}", $responseElement =
"", $parameters = array()) {
761 $parameters[
'method'] =
'post';
762 $parameters[
'params'] = $params;
763 return $this->
ajaxOn($event, $element, $url, $responseElement, $parameters);
780 public function postOnClick($element, $url, $params =
'{}', $responseElement =
'', $parameters = array()) {
781 return $this->
postOn(
'click', $element, $url, $params, $responseElement, $parameters);
784 private function _postForm($url, $form, $responseElement, $parameters = []) {
785 if (isset($this->params[
'ajax'])) {
786 extract($this->params[
'ajax']);
790 \extract($parameters);
791 $async = ($async) ?
'true' :
'false';
792 $jsCallback = isset($jsCallback) ? $jsCallback :
"";
795 $retour .=
"\n$('#'+" . $form .
").trigger('ajaxSubmit');";
796 if (! isset($contentType) || $contentType !=
'false') {
797 $retour .=
"\nlet params=$('#'+" . $form .
").serialize();\n";
798 if (isset($params)) {
802 $retour .=
"\nlet params=new FormData($('#'+" . $form .
")[0]);\n";
805 $retour .=
"let self=this;\n";
806 $before = isset($before) ? $before :
"";
808 if ($hasLoader ===
true) {
810 } elseif ($hasLoader ===
'response') {
812 } elseif ($hasLoader ===
'internal-x') {
814 } elseif ($hasLoader ===
'internal') {
815 $retour .=
"\n$(this).addClass('loading');";
816 } elseif (\is_string($hasLoader)) {
817 $retour .=
"\n$hasLoader.addClass('loading');";
821 "method" =>
"'POST'",
825 if (isset($headers)) {
826 $ajaxParameters[
"headers"] = $headers;
828 if (isset($partial)) {
829 $ajaxParameters[
"xhr"] =
"xhrProvider";
830 $retour .=
"let xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial .
";}; };";
833 $retour .=
"$.ajax({" . $this->
implodeAjaxParameters($ajaxParameters) .
"}).done(function( data ) {\n";
836 $retour .=
'.fail(function( jqXHR, textStatus, errorThrown ){' . $error .
'})';
838 $retour .=
'.always(function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {' . ($always ??
'') . $this->
removeLoader($hasLoader) .
'})';
841 $retour =
"$('#'+" . $form .
").validate({submitHandler: function(form) {
844 $retour .=
"$('#'+" . $form .
").submit();\n";
848 $this->jquery_code_for_compile[] = $retour;
864 public function postForm($url, $form, $responseElement, $parameters = []) {
865 $parameters[
'immediatly'] =
true;
866 return $this->
_postForm($url, $form, $responseElement, $parameters);
883 $parameters[
'immediatly'] =
false;
884 return $this->
_postForm($url, $form, $responseElement, $parameters);
900 public function postFormOn($event, $element, $url, $form, $responseElement =
"", $parameters = array()) {
902 'preventDefault' =>
true,
903 'stopPropagation' =>
true,
904 'immediatly' =>
true,
905 'listenerOn' =>
false
907 return $this->
_add_event($element, $this->
postFormDeferred($url, $form, $responseElement, $parameters), $event, $parameters[
"preventDefault"], $parameters[
"stopPropagation"], $parameters[
"immediatly"], $parameters[
'listenerOn']);
922 public function postFormOnClick($element, $url, $form, $responseElement =
"", $parameters = array()) {
923 return $this->
postFormOn(
"click", $element, $url, $form, $responseElement, $parameters);
926 public function addCsrf($name =
'csrf-token') {
929 beforeSend: function(xhr, settings) {
930 let csrfSafeMethod=function(method) { return (/^(GET|HEAD|OPTIONS)$/.test(method));};
931 if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
932 xhr.setRequestHeader('{$name}', $('meta[name=\"{$name}\"]').attr('content'));
postDeferred($url, $params="{}", $responseElement="", $parameters=[])
Prepares a delayed ajax POST to use on an event.
jsonDeferred($url, $method='get', $parameters=[])
Prepares an ajax request delayed and receives the JSON data types by assigning DOM elements with the ...
setDefaultParameters(&$parameters, $default)
postHref($element, $responseElement="", $parameters=array())
Uses an hyperlink to make an ajax get request.
getOnClick($element, $url, $responseElement='', $parameters=array())
Performs a get to $url on the click event on $element and display it in $responseElement.
postFormOnClick($element, $url, $form, $responseElement="", $parameters=array())
Performs a post form with ajax in response to the click event on $element display the result in $resp...
ajaxOn($event, $element, $url, $responseElement='', $parameters=array())
Performs an ajax request to $url on the event $event on $element and display it in $responseElement.
_jsonArray($maskSelector, $url, $method='get', $parameters=[])
Performs an ajax request and receives the JSON array data types by assigning DOM elements with the sa...
ajaxInterval($method, $url, $interval, $globalName=null, $responseElement='', $parameters=[], $immediatly=true)
Executes an ajax query at regular intervals.
getDeferred($url, $responseElement="", $parameters=[])
Prepares a Get ajax request for using on an event.
implodeAjaxParameters($ajaxParameters)
getHref($element, $responseElement="", $parameters=array())
Uses an hyperlink to make an ajax get request.
static _correctParams($params, $ajaxParameters=[])
_addJsCondition($jsCondition, $jsSource)
ajaxDeferred($method, $url, $responseElement='', $parameters=[])
Performs a deferred ajax request.
ajaxOnClick($element, $url, $responseElement='', $parameters=array())
Performs a get to $url on the click event on $element and display it in $responseElement.
_ajax($method, $url, $responseElement='', $parameters=[])
jsonArray($maskSelector, $url, $method='get', $parameters=[])
Performs an ajax request and receives the JSON array data types by assigning DOM elements with the sa...
postFormAction($element, $responseElement="", $parameters=array())
Uses a form action to make an ajax post request.
jsonOn($event, $element, $url, $method='get', $parameters=array())
Makes an ajax request and receives the JSON data types by assigning DOM elements with the same name w...
_postForm($url, $form, $responseElement, $parameters=[])
postFormDeferred($url, $form, $responseElement, $parameters=[])
Performs a delayed post form with ajax For use on an event.
_add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false)
_getFormElement($formElement)
createAjaxParameters(&$original, $parameters)
postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array())
Performs a post to $url on the event $event fired on $element and pass the parameters $params Display...
_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $history=null)
jsonArrayDeferred($maskSelector, $url, $method='get', $parameters=[])
Peforms an ajax request delayed and receives a JSON array data types by copying and assigning them to...
addResponseLoading(&$retour, $responseElement, $ajaxLoader=null)
post($url, $params="{}", $responseElement="", $parameters=[])
Makes an ajax post.
interval($jsCode, $time, $globalName=null, $immediatly=true)
_post($url, $params='{}', $responseElement='', $parameters=[])
addLoading(&$retour, $responseElement, $ajaxLoader=null)
postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array())
Performs a post form with ajax in response to an event $event on $element display the result in $resp...
ajax($method, $url, $responseElement='', $parameters=[])
Performs an ajax request.
autoActiveLinks($previousURL="window.location.href")
_get($url, $responseElement='', $parameters=[])
Performs an ajax GET request.
postOnClick($element, $url, $params='{}', $responseElement='', $parameters=array())
Performs a post to $url on the click event fired on $element and pass the parameters $params Display ...
static _implodeParams($parameters)
getOn($event, $element, $url, $responseElement="", $parameters=array())
Performs a get to $url on the event $event on $element and display it in $responseElement.
postForm($url, $form, $responseElement, $parameters=[])
Performs a post form with ajax.
_json($url, $method="get", $parameters=[])
Performs an ajax request and receives the JSON data types by assigning DOM elements with the same nam...
addCsrf($name='csrf-token')
jsonArrayOn($event, $element, $maskSelector, $url, $method='get', $parameters=array())
Performs an ajax request and receives the JSON array data types by assigning DOM elements with the sa...
_getResponseElement($responseElement)
json($url, $method="get", $parameters=[])
Performs an ajax request and receives the JSON data types by assigning DOM elements with the same nam...