The request is the only method you need to call when you use DynAjax.
It takes two parameters: one string containing the request attributes, and a js function to handle the response (optional)
request(attributestring, resultfunc)
The attributes string
Format of the attribute string: 'attribute1: value1; attribute2: value2; ...'
- respfile
The name of the responsefile. It can also contain parameters
(eg. 'respfile: response.php;' or 'respfile: response.jsp?myparam=mydata;') - resultloc
A string containing the id of the HTML element the result will be placed to.
(eg. 'resultloc: mydiv;') - paramdiv
A string containing the id of the HTML element that contains the input fields necessary to be posted to the server. Put null if you don't want to send html data.
The input fields can be:- input text
<input type="text" name="mytext" />
- input hidden text
<input type="hidden" name="myhidden" />
- input radiobutton
<input type="radio" name="myradio" />
- input checkbox
<input type="checkbox" name="mycheck" />
- textarea
<textarea name="mytextarea"></textarea>
- refreshtime
An integer number. The request will be resent each refreshtime millisecs. - conftext
If specified, a confirmation box will pop up containing the given text before the request is sent. - loadmsg
If specified, this message will be put into the result location
(will be replaced when the servers responds) - loadmsgloc
The loading message will be placed into this location instead of the result location, if specified.
Resultfunc parameter
Optional. Can take a javascript function that will be called when the response is given. The response data will be available in its first argument. eg:
function myFunction(responsetext) {
alert(responsetext);
}
request('respfile: response.jsp;', myFunction);
Object attributes