This article mainly introduces in detail the implementation of Ajax Based on jQuery to verify whether the user name has an instance, which has some reference value, interested friends can refer to this article to share with you the implementation code of jQuery-based Ajax verification of user name existence, the Code farmers who need can refer to the source code of this article.
JQuery. ajax Overview
HTTP requests load remote data.
Implemented through jQuery underlying AJAX. For easy-to-use high-level implementation, see $. get, $. post, and so on. $. Ajax () returns the created XMLHttpRequest object. In most cases, you do not need to directly operate on this object, but in special cases it can be used to manually terminate the request.
$. Ajax () has only one parameter: The parameter key/value object, which contains information about various configurations and callback functions. For detailed Parameter options, see.
Note:If you specify the dataType option, make sure that the server returns the correct MIME information (for example, xml returns "text/xml "). Incorrect MIME types may cause unpredictable errors.
Note:If dataType is set to "script", all POST requests will be converted to GET requests during remote requests (not in the same domain. (Because the script tag of DOM will be used for loading)
In jQuery 1.2, you can load JSON data across domains. You need to set the data type to JSONP during use. When calling a function in the form of JSONP, such as "myurl? Callback =? "Will jQuery be replaced automatically? For the correct function name to execute the callback function. When the data type is set to "jsonp", jQuery automatically calls the callback function.
Parameter List:
There are several Ajax event parameters: beforeSend, success, complete, and error. We can define these events to process every Ajax request. Note that this in these Ajax events points to the option Information of the Ajax request (see the image of this in the get () method ).
Read the parameter list carefully. If you want to use jQuery for Ajax development, you must be familiar with these parameters.
Instance:
1. Request AJax. aspx
HTML code
P>
JS Code