-
Notifications
You must be signed in to change notification settings - Fork 0
Ajax library
abidibo edited this page Jun 10, 2011
·
1 revision
This library consists of a function used to manage ajax requests
##ajaxRequest function performs post and get asynchronous requests
###Arguments
- method - (string) The method can be either post or get
- url - (string) The requested url
- data - (string) The datas of the request in the form 'var1=value1&var2=value2'
- target - (mixed) The element DOM Object or the element id of the DOM element that have to be updated with the request response
- options (object) * cache - (bool default to false) Whether to cache the request result or not * cacheTime - (int default 3600000 [1hr]) The time in milliseconds to keep the request in cache * load - (mixed default null) The element DOM Object or the element id of the DOM element to use to show the loading image * script - (bool default false) True if scripts have to be executed, false if not * setvalue - (bool default false) True if script response must be set as the target value * callback - (function dafault null) The function to call after the request has been executed * callback_params - (string default null) The params passed to the callback function
if the called method has to return an error, must return a string like:
request error:Error description
this way the method is not executed and an alert is displayed with the message "Error description"