JavaScript Ajax class Ajax request 2007-12-31 update

Time:2022-4-15

Ajax request is a lightweight Ajax Application development framework, compatible with Firefox, ie, opera and safari. It can easily carry out some operations often used in Ajax, so as to simplify the development steps and reduce the amount of repeated code writing.

If you find problems in the process of use, or have good comments and suggestions, you can send me an email, vipxjw [at] 163 [dot] com.

AJAXRequest v0. Issued on December 31, 2007

    1. Add the # stopupdate # method

    2. Modify the return value of the # update # method to the update request ID, which is used to # Ajax request # stop updating

    3. Modify the form validation attribute of the # postf # method to # onsubmit # OnValidate

    4. Modify the parameter of the “postf” method to “post” (form, [callback]) and remove the “action” and “method” parameters

    5. Fixed the problem that the default value of the # post # method parameter # content # is not the global # content # attribute

    6. Fixed the problem that “+” is a space when transmitting and receiving “+” in the “postf” method

    7. Fixed the problem that the # onrequeststart # and # onrequestend # names in the # Ajax request # class construction parameters were incorrect

    8. Fixed the issue of sending requests using synchronization

For more details, see the Ajax request Developer’s Manual: http://ajax.xujiwei.cn/
For more usage examples, see the Ajax request development example: http://www.xujiwei.cn/demo/ajaxrequest/
Update description

1. Modify the return value of update method to update request ID

In this version, the update method no longer returns a timer ID, that is, you can no longer use the return value of the update method as a parameter and use the clearinterval method to stop the update, but instead use the stopupdate method inside Ajax request to stop the update.

In addition, not only unlimited updates will return the update ID, but limited updates will also return the update ID, that is, if you only update the specified number of times, you can also use the stopupdate method to stop the update before reaching the specified number of times.

Example (JavaScript):

Program code: [copy code to clipboard]

Copy codeThe code is as follows:
// code sample by xujiwei 
// site: http://www.xujiwei.cn/ 
var ajax = new AJAXRequest(); 
var u; 
//Start unlimited times from test. At an interval of 1 second ASP update object updateobj
function start() { 
    u = ajax.update(“updateObj”, “test.asp”, 1000); 

//Stop update
function stop() { 
    ajax.stopupdate(u); 

2. Modify the form validation attribute of the # postf # method # onsubmit # to # OnValidate

If onsubmit is used for form validation, it may conflict with some applications. Therefore, change the form validation attribute to OnValidate, for example (HTML):

Copy codeThe code is as follows:
// code sample by xujiwei 
// site: http://www.xujiwei.cn/ 
<form action=”test.asp” method=”post” onvalidate=”return checkForm();”> 
</form> 

3. Modify the parameter of the post method to post (form, [callback])

This modification limits the parameters of the postf method to form objects and callback functions, that is, the action and method must be specified in the form tag, for example (HTML):

Program code:

Copy codeThe code is as follows:
// code sample by xujiwei 
// site: http://www.xujiwei.cn/ 
//The action and method properties of the form tag must be specified
<form action=”test.asp” method=”post”> 
</form> 

Local download

Recommended Today

About interpersonal relationships

Not long ago, a classmate told me that his interpersonal relationship was very poor since he was a child. Few people in school played well. Usually he was alone. He had long recognized that this situation was bad, but he was also used to it.   But now that I have graduated, I am about […]