Documentation
PlainAjax
PlainAjax is a single class, plainajax.js instantiates a single object: plainajax. That object is responsible for handling Ajax requests / result processing.
At each Ajax request plainajax submits the request and dynamically generates the JavaScript code that processes the response (and optionally passes the response to a user-specified javascript function)
PlainAjax class summary
Constructor summary
-
PlainAjax()
Initializes a PlainAjax object
Attribute summary
-
timeout
Sets a timeout for receiving ajax responses (millisecs).
Function summary
-
request(paramstring, resultfunc)
Sends an Ajax request, configured in paramstring. The result can be optionally passed to a javascript function (resultfunc). The function will receive the response as a string in its first argument.
Request parameter string summary
The parameter string is expected to have key-value pairs in the following format:
key1: value1; key2: value2; ...
The configuration:
-
respurl
The URL of the server-side request (eg ajax/example.jsp)
-
resultloc (optional)
The ID of the HTML element the response will be put.
-
paramloc (optional)
The ID of the HTML element that contains the HTML inputs to be submitted
-
loadmsg (optional)
Its content is going to be displayed while waiting for a response. Puts the loading message to resultloc by default.
-
loadmsgloc (optional)
The loading message's location can be overridden
-
conftext (optional)
If defined, PlainAjax will requests confirmation before submitting the ajax request.
-
autoresend (optional)
If defined, PlainAjax will re-submit the ajax request periodicaly at this rate (millisecs)