Error debugging help information about JQuery. Ajax

Source: Internet
Author: User

The following is a detailed list of AJAX parameters in Jquery:


Timeout Number Set the request timeout (in milliseconds ). This setting overwrites the global setting.
Async Boolean (Default: true) by default, all requests are asynchronous requests. To send a synchronization request, set this option to false. Note: The synchronous request locks the browser. Other operations can be performed only after the request is completed.
BeforeSend Function Before sending a request, you can modify the function of the XMLHttpRequest object, for example, adding a custom HTTP header. The XMLHttpRequest object is a unique parameter.
function (XMLHttpRequest) { this; // the options for this ajax request }
Cache Boolean (Default: true) New jQuery 1.2 function. setting this parameter to false will not load request information from the browser cache.
Complete Function Callback Function after the request is complete (called when the request is successful or fails ). Parameter: XMLHttpRequest object, success information string.
function (XMLHttpRequest, textStatus) { this; // the options for this ajax request }
ContentType String (Default: "application/x-www-form-urlencoded") Content Encoding type when sending information to the server. The default value is applicable to most applications.
Data Object, String Data sent to the server. Will be automatically converted to the request string format. The GET request will be appended to the URL. View the description of the processData option to disable automatic conversion. It must be in Key/Value format. If it is an array, jQuery automatically corresponds to the same name for different values. For example, {foo: ["bar1", "bar2"]} is converted to '& foo = bar1 & foo = bar2 '.
DataType String

Expected data type returned by the server. If this parameter is not specified, jQuery will automatically return responseXML or responseText Based on the MIME information of the HTTP package and pass it as a callback function parameter. Available values:

"Xml": returns an XML document, which can be processed by jQuery.

"Html": returns plain text HTML information, including script elements.

"Script": returns plain text JavaScript code. Results are not automatically cached.

"Json": Return JSON data.

"Jsonp": JSONP format. 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.

Error Function (Default: automatically determines (xml or html) This method is called when a request fails. This method has three parameters: XMLHttpRequest object, error message, and (possibly) captured error object.
Function (XMLHttpRequest, textStatus, errorThrown) {// Generally, only one of textStatus and errorThown has the value this; // the options for this ajax request}
Global Boolean (Default: true) Whether to trigger a global AJAX event. Setting false does not trigger global AJAX events, such as ajaxStart or ajaxStop. Can be used to control different Ajax events
IfModified Boolean (Default: false) obtain new data only when the server data changes. Use the Last-Modified header information of the HTTP packet to determine.
ProcessData Boolean (Default: true) by default, data sent is converted to an object (technically not a string) with the default content type "application/x-www-form-urlencoded ". If you want to send the DOM tree information or other information that does not want to be converted, set it to false.
Success Function Callback Function after successful request. This method has two parameters: the server returns data and returns the status.
function (data, textStatus) { // data could be xmlDoc, jsonObj, html, text, etc... this; // the options for this ajax request }
Copy codeThe Code is as follows: $ (document). ready (function (){
JQuery ("# clearCac"). click (function (){
JQuery. ajax ({
Url: "/Handle/Do. aspx ",
Type: "post ",
Data: {id: '0 '},
DataType: "json ",
Success: function (msg ){
Alert (msg );
},
Error: function (XMLHttpRequest, textStatus, errorThrown ){
Alert (XMLHttpRequest. status );
Alert (XMLHttpRequest. readyState );
Alert (textStatus );
},
Complete: function (XMLHttpRequest, textStatus ){
This; // The options parameter passed when calling this AJAX request
}
});
});
});

 

I. error: function (XMLHttpRequest, textStatus, errorThrown)
{
}
(Default: automatically determines (xml or html) The call time when the request fails. There are three parameters: XMLHttpRequest object, error message, and (optional) captured error object. If an error occurs, in addition to null, the error message (the second parameter) may also be "timeout", "error", "notmodified", and "parsererror ".

TextStatus:

"Timeout", "error", "notmodified", and "parsererror ".

II. The first parameter XMLHttpRequest returned by the error event has some useful information:
 
XMLHttpRequest. readyState:

Status Code
-(Not initialized) The send () method has not been called.
-(Load) The send () method has been called and a request is being sent.
-(Loading completed) The send () method is executed completely and all response content has been received
-(Interaction) The response content is being parsed
-(Complete) The response content is parsed and can be called on the client.

3. data: "{}". If the data is empty, you must pass "{}". Otherwise, the returned data is in xml format. The system prompts parsererror.
 
4. parsererror exceptions are also related to the Header type.And encoding header ('content-type: text/html; charset = utf8 ');

5. XMLHttpRequest. status:
Xx-Information prompt
These status codes indicate temporary responses. Before receiving a regular response, the client should be prepared to receive one or more 1xx responses.
-Continue.
-Switch protocol.

Xx-success
This type of Status Code indicates that the server successfully accepts client requests.
-OK. The client request is successful.
-Created.
-Accepted.
-Non-authoritative information.
-No content.
-Reset the content.
-Some content.

Xx-redirection
The client browser must perform more operations to implement the request. For example, the browser may have to request different pages on the server or repeat the request through the proxy server.
-The object has been permanently removed, that is, permanent redirection.
-The object has been temporarily moved.
-Not modified.
-Temporary redirection.

Xx-client Error
The client seems to be faulty when an error occurs. For example, the client does not provide valid authentication information for a page that does not exist in a request. 400-Incorrect request.
-Access denied. IIS defines many different 401 errors, which indicate more specific error causes. These specific error codes are displayed in the browser but not in the IIS log:
. 1-Logon Failed.
. 2-login failed due to server configuration.
. 3-The ACL is not authorized due to resource restrictions.
. 4-filter authorization failed.
. 5-ISAPI/CGI application authorization fails.
. 7-access is rejected by the URL Authorization Policy on the Web server. This error code is dedicated to IIS6.0.
-Access prohibited: IIS defines many different 403 errors, which indicate more specific error causes:
. 1-the execution access is forbidden.
. 2-Read access is forbidden.
. 3-write access is forbidden.
. 4-require SSL.
. 5-SSL128 is required.
. 6-IP address is rejected.
. 7-client certificate required.
. 8-site access is denied.
. 9-too many users.
. 10-The configuration is invalid.
. 11-Change Password.
. 12-access to the ing table is denied.
. 13-The client certificate is revoked.
. 14-reject the directory list.
. 15-The client access permission is exceeded.
. 16-The client certificate is untrusted or invalid.
. 17-the client certificate has expired or has not yet taken effect.
. 18-the requested URL cannot be executed in the current application pool. This error code is dedicated to IIS6.0.
. 19-CGI cannot be executed for clients in the application pool. This error code is dedicated to IIS6.0.
. 20-logon to Passport failed. This error code is dedicated to IIS6.0.
-Not found.
. 0-(none)-No file or directory found.
. 1-you cannot access the Web site on the requested port.
. 2-the Web service extended locking policy blocks this request.
. 3-the MIME ing policy blocks this request.
-HTTP predicates used to access this page are not allowed (methods are not allowed)
-The client browser does not accept the MIME type of the requested page.
-Proxy authentication is required.
-Precondition failed.
-The Request Entity is too large.
-The request URI is too long.
-Unsupported media type.
-The requested range cannot be met.
-Execution failed.
-Locking error.

Xx-Server Error

The server cannot complete the request because of an error.
-Internal Server error.
. 12-The application is busy restarting on the Web server.
. 13-The Web server is too busy.
. 15-Direct Request to Global. asa is not allowed.
The. 16-UNC authorization credential is incorrect. This error code is dedicated to IIS6.0.
. 18-URL authorized storage cannot be opened. This error code is dedicated to IIS6.0.
. 100-Internal ASP error.
-The header value specifies the unimplemented configuration.
-When the Web server is used as a gateway or proxy server, it receives an invalid response.
. 1-CGI application timeout.
. 2-CGI application error. Application.
-The service is unavailable. This error code is dedicated to IIS6.0.
-Gateway timeout.
-The HTTP version is not supported.
FTP

Xx-Affirmative preliminary reply
These status codes indicate that an operation has started successfully, but the client wants to receive another response before continuing to operate the new command.
Restart to mark the reply.
The service is ready and starts in nnn minutes.
The data connection is enabled and transmission is starting.
The file is in normal state and you are ready to open the data connection.

Xx-a positive response
An operation has been completed successfully. The client can execute new commands. 200 command OK.
No command is executed. There are too many commands on the site.
System status, or system help reply.
Directory status.
File status.
Help message.
NAME system type, where NAME is the formal system NAME listed in the AssignedNumbers document.
The service is ready to execute new user requests.
The service closes the control connection. If appropriate, log out.
The data connection is opened and there is no transmission in progress.
Close the data connection. The requested file operation has been successful (for example, transferring a file or dropping a file ).
Enter the passive mode (h1, h2, h3, h4, p1, p2 ).
The user has logged on and continues.
The requested file operation is correct and has been completed.
"PATHNAME" has been created ".

Xx-Affirmative intermediate reply
The command is successful, but the server needs more information from the client to process the request. 331 the user name is correct and the password is required.
You need to log on to the account.
The requested file operation is waiting for further information.

Xx-completion reply of transient Negation
The command fails, but the error is temporary. If the client retries the command, it may be executed successfully. 421 the service is unavailable and the control connection is being closed. If the Service determines that it must be disabled, this response will be sent to any command.
Unable to open data connection.
Connectionclosed; transferaborted.
The requested file operation is not performed. The file is unavailable (for example, the file is busy ).
Request operation exception termination: processing local error.
The requested operation is not performed. Insufficient system storage space.

Xx-permanent completion reply

The command fails. The error is permanent. If the client retries the command, the same error will occur again. 500 syntax error. The command cannot be identified. This may include errors such as too long command lines.
Syntax errors exist in parameters.
No command is executed.
Wrong command sequence.
The command for this parameter is not executed.
Not logged on.
An account is required to store files.
The requested operation is not performed. File is unavailable (for example, the file is not found and no access permission is available ).
Exceptional request termination: Unknown page type.
The requested file operation ends abnormally: exceeds the storage allocation (for the current directory or dataset ).
The requested operation is not performed. The file name is not allowed.
Common FTP status code and Its Causes
-FTP uses two ports: 21 for sending commands and 20 for sending data. Status Code 150 indicates that the server is preparing to open a new connection on Port 20 and send some data.
-Open a data connection on Port 20 to perform operations, such as transferring files. This operation is successfully completed and the data connection is closed.
-The status code is displayed after the client sends the correct password. It indicates that the user has successfully logged on.
-The status code is displayed after the client sends the user name. This status code is displayed no matter whether the user name is a valid account in the system.
-The command opens the data connection to execute the operation, but the operation has been canceled and the data connection has been closed.
-The Status Code indicates that the user cannot log on because the combination of the user name and password is invalid. If you log on with a user account, you may enter the wrong user name or password, or you may choose to allow anonymous access only. If you log on with an anonymous account, the IIS configuration may reject anonymous access.
-The command is not executed because the specified file is unavailable. For example, the file to GET does not exist, or you try to PUT the file to a directory without the write permission.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.