A JavaScript Library for AJAX Requests (Recursive) with form submission, url registeration, Recursive Requests
-
Format:
JAX.URL(URL, QUERY_PARAMETERS, REQUEST_METHOD, SUCCESS_CALLBACK, FAILURE_CALLBACK, END_RESULT)
Example:
JAX.URL("http://github.com", {}, "POST", (function($data){ console.log($data); }), null, "JSON")
-
Format:
JAX.GET(RGISTERED_URL_INDEX)
orJAX.URL(URL, QUERY_PARAMETERS, REQUEST_METHOD, SUCCESS_CALLBACK, FAILURE_CALLBACK, END_RESULT)
Example:
JAX.URL(0)
-
Format:
JAX.registerLoader(HTML_ID_OR_HTML_OBJECT, CLASS_THAT_STARTS_THE_LOADER)
Example:
JAX.registerLoader($('#loader')[0], "active")
orJAX.registerLoader("loader", "active")
-
Format:
JAX.runLoader()
-
Format:
JAX.sendForm(REGISTERED_URL_INDEX, HTML_FORM_ELEMENT)
Example:
$('form').on("submit", function() { JAX.sendForm(0, this); })
Recursive/Cyclic/Repititive Requests are requests that gets made at intervals of time, they can be hold or left to run to infinity. Recursive Requests are useful for doing a no load message chatting system, instant notification system e.t.c
You Create a JAX Cyclic Request
$cq = new JAX.CyclicRequest(URL, REQUEST_METHOD, QUERY_PARAMETERS, DELAY_IN_MILLISECONDS);
You Start it:
$cq.start();
Format: $cq.EVENT_NAME = function(){ //...block of code }
When the Request was completed successfully just like the success callback
When the Request Failed (Normally not Always Called)
Called Before the Start of every request cycle
Called at the very end of every request cycle
Format: $cq.CONTROL_NAME()
stops the continuity of the request
continues a sttoped requests
CALLBACKS can either be a function or the name of a function and they take argument which will contain the refined responseText from the url. At present, JAX can only runs 1 Request at a time but we hope to change this soon meanwhile, Enjoy JAXIFY to the Fullest.
Note: THIS IS NOT YET A STABLE RELEASE OF JAXIFY.JS BUT YOU ARE FREE TO TRY IT AND GIVE US CONTRIBUTIONS OR IDEAS