AJAX (xmlhttprequest.status) status code _ajax related

Source: Internet
Author: User
Tags anonymous ftp string format browser cache
The following is a detailed list of Ajax parameters in jquery
Name of parameter Type Describe
Url String (Default: Current page address) sends the requested address.
Type String (Default: "Get") Request method ("POST" or "get"), default to "get". Note: Other HTTP request methods, such as put and DELETE, are also available, but only partially supported by browsers.
Timeout Number Sets the request timeout (in milliseconds). This setting overrides the global setting.
Async Boolean (Default: TRUE) The default setting is that all requests are asynchronous requests. If you need to send a sync request, set this option to false. Note that the synchronization request will lock the browser and the user's other actions must wait for the request to complete before it can be executed.
Beforesend Function You can modify the functions of the XMLHttpRequest object before sending the request, such as adding a custom HTTP header. The XMLHttpRequest object is the only parameter.
function (XMLHttpRequest) {
This The options for this AJAX request
}
Cache Boolean (default: TRUE) JQuery 1.2 new functionality, set to false will not load request information from the browser cache.
Complete Function The callback function (called when the request succeeds or fails) after the request completes. Parameters: XMLHttpRequest Object, Success message string.
function (XMLHttpRequest, textstatus) {
This The options for this AJAX request
}
ContentType String (Default: "application/x-www-form-urlencoded") the content encoding type when sending information to the server. Default values are appropriate for most applications.
Data Object,
String
Data sent to the server. is automatically converted to the request string format. The GET request is appended to the URL. View the ProcessData option description to prevent this automatic conversion. Must be in the Key/value format. If you are an array, JQuery will automatically correspond to the same name for different values. such as {foo:["bar1", "Bar2"]} is converted to ' &foo=bar1&foo=bar2 '.
DataType String

The type of data expected to be returned by the server. If not specified, JQuery will automatically return Responsexml or responsetext based on the HTTP packet MIME information and pass as a callback function parameter, available values:

"XML": Returns an XML document that can be processed with jQuery.

HTML: Returns plain text HTML information, including script elements.

Script: Returns the plain text JavaScript code. Results are not automatically cached.

"JSON": Returns JSON data.

"JSONP": Jsonp format. When calling a function using JSONP form, such as "myurl?callback=?" JQuery is automatically replaced? To the correct function name to execute the callback function.

Error Function (Default: Automatic judgment (XML or HTML)) This method is called when a request fails. This method has three parameters: the XMLHttpRequest object, the error message, and (possibly) the error object being caught.
function (XMLHttpRequest, textstatus, Errorthrown) {

This The options for this AJAX request
}
Global Boolean (default: TRUE) triggers a global AJAX event. Setting to FALSE will not trigger global AJAX events, such as Ajaxstart or Ajaxstop. Can be used to control different AJAX events
Ifmodified Boolean (default: false) gets new data only when the server data changes. Use HTTP packet last-modified header information to determine.
ProcessData Boolean (default: TRUE) by default, the data sent is converted to an object (technically not a string) to match the default content type "application/x-www-form-urlencoded". Set to False if you want to send DOM tree information or other information that you do not want to convert.
Success Function callback function after successful request. This method has two parameters: the server returns the data, returns the status
function (data, textstatus) {
Data could be xmldoc, jsonobj, HTML, text, etc ...
This The options for this AJAX request
}

Code
Copy Code code 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 argument passed when invoking this Ajax request
}
});
});
});

I. Error:function (XMLHttpRequest, Textstatus, Errorthrown)
{
}
(Default: Automatic judgment (XML or HTML)) when a request fails to call time. The parameter has the following three: XMLHttpRequest object, error message, optionally caught error object. If an error occurs, the error message (the second argument) may be "timeout", "error", "Notmodified", and "ParserError" in addition to being null.
Textstatus:
"Timeout", "error", "Notmodified" and "ParserError".

Second, the Error event returns the first parameter XMLHttpRequest some useful information:
Xmlhttprequest.readystate:
Status code
0-(uninitialized) the Send () method has not been called
1-(load) called Send () method, sending request
2-(load complete) Send () method completed, received all response content
3-(interactive) parsing response content
4-(complete) The response content resolution is complete and can be invoked on the client

Third, data: "{}", data is empty also must pass "{}"; otherwise, the return is in XML format. and prompts ParserError.

The ParserError exception and header type are also related. and encoded header (' content-type:text/html; Charset=utf8 ');

Five, Xmlhttprequest.status:
1xx-Information Tips
These status codes represent a temporary response. The client should be prepared to receive one or more 1xx responses before receiving a regular response.
100-Continue.
101-Switch protocol.
2xx-success
This type of status code indicates that the server successfully accepted the client request.
200-OK. The client request was successful.
201-created.
202-accepted.
203-Non-authoritative information.
204-no content.
205-Reset the content.
206-part content.
3xx-redirect
The client browser must take more action to implement the request. For example, a browser might have to request a different page on the server, or repeat the request through a proxy server.
301-The object has been permanently removed, that is, permanent redirection.
302-The object has been temporarily moved.
304-not modified.
307-Temporary redirection.
4xx-Client Error
An error occurred and the client appears to have a problem. For example, a client requests a page that does not exist, and the client does not provide valid authentication information. 400-the wrong request.
401-access is denied. IIS defines a number of different 401 errors that indicate a more specific cause of the error. These specific error codes are displayed in the browser but are not displayed in the IIS log:
401.1-Login failed.
The 401.2-server configuration caused the login to fail.
401.3-Authorization is not granted due to ACL restrictions on resources.
401.4-Filter Authorization failed.
401.5-ISAPI/CGI application authorization failed.
401.7– access is denied by the URL authorization policy on the Web server. This error code is dedicated to IIS6.0.
403-Prohibit access: IIS defines a number of different 403 errors that indicate a more specific cause of the error:
403.1-execution access is prohibited.
403.2-Read access is prohibited.
403.3-Write access is prohibited.
403.4-Require SSL.
403.5-Request SSL128.
The 403.6-IP address was rejected.
403.7-Client certificate required.
403.8-site access is denied.
403.9-Excessive number of users.
403.10-Configuration is not valid.
403.11-Password change.
403.12-access to the mapping table is denied.
403.13-The client certificate was revoked.
403.14-Deny directory list.
403.15-Client access permission exceeded.
403.16-Client certificate is not trusted or invalid.
403.17-The client certificate has expired or has not yet taken effect.
403.18-The requested URL cannot be executed in the current application pool. This error code is dedicated to IIS6.0.
403.19-CGI cannot be performed for clients in this application pool. This error code is dedicated to IIS6.0.
403.20-passport Login failed. This error code is dedicated to IIS6.0.
404-not found.
404.0-(None) – No files or directories found.
404.1-The Web site cannot be accessed on the requested port.
The 404.2-web service extension lockout policy blocks this request.
The 404.3-mime mapping policy blocks this request.
405-HTTP predicates used to access this page are not allowed (methods are not allowed)
406-The client browser does not accept the MIME type of the requested page.
407-proxy authentication is required.
412-Prerequisite failed.
The 413– request entity is too large.
414-The request URI is too long.
415– media type that is not supported.
416– the requested range is not satisfied.
417– execution failed.
423– the locked error.
5xx-Server Error
The server was unable to complete the request due to an error encountered.
500-Internal server error.
The 500.12-application is busy restarting on the Web server.
The 500.13-web server is too busy.
500.15-Direct Request Global.asa is not allowed.
The 500.16–unc authorization credentials are incorrect. This error code is dedicated to IIS6.0.
The 500.18–url authorization store cannot be opened. This error code is dedicated to IIS6.0.
500.100-Internal ASP error.
501-The header value specifies a configuration that is not implemented.
An invalid response was received when the 502-web server was used as a gateway or proxy server.
The 502.1-cgi application timed out.
Error 502.2-cgi application. Application.
503-The service is not available. This error code is dedicated to IIS6.0.
The 504-gateway timed out.
505-http version is not supported.
Ftp
1xx-a positive initial reply
These status codes indicate that an operation has started successfully, but the client expects another reply before continuing with the new command.
110 reboot the tag reply.
120 The service is ready and starts after nnn minutes.
125 The data connection is turned on and the transfer is starting.
150 file status is normal, ready to open data connection.
2xx-definitely complete the answer
An operation has completed successfully. The client can execute the new command. 200 the command determines.
202 command is not executed, too many commands on the site.
211 System State, or system help reply.
212 Directory status.
213 file status.
214 Help messages.
215NAME system type, where name is the official system name listed in the Assignednumbers document.
220 The service is ready to execute the new user's request.
221 The service closes the control connection. If appropriate, please log off.
225 The data connection is open and no transmission is in progress.
226 Close the data connection. The requested file operation was successful (for example, transferring a file or discarding a file).
227 into the passive mode (H1,H2,H3,H4,P1,P2).
230 The user is logged in and continues.
250 The requested file operation is correct and completed.
257 has created "PATHNAME".
3xx-Affirmation of the middle reply
The command was successful, but the server needed more information from the client to complete processing of the request. 331 username is correct and requires a password.
332 login account required.
350 The requested file operation is waiting for further information.
Complete response to 4xx-transient negation
The command did not succeed, but the error is temporary. If the client retries the command, it may execute successfully. The 421 service is not available and is shutting down the control connection. If the service determines that it must be closed, this response is sent to any command.
425 The data connection could not be opened.
426connectionclosed;transferaborted.
450 The requested file operation was not executed. File is not available (for example, the file is busy).
451 the requested operation terminated abnormally: A local error is being processed.
452 the requested operation was not performed. The system does not have enough storage space.
5xx-a permanent negative completion reply
The command is not successful and the error is permanent. If the client retries the command, the same error occurs again. 500 syntax error, command not recognized. This may include errors such as the command line being too long.
501 There is a syntax error in the parameter.
502 did not execute the command.
503 wrong sequence of commands.
504 The command that did not execute the parameter.
530 not logged in.
532 requires an account for storing files.
550 the requested operation was not performed. File is not available (for example, file not found, no access rights).
551 The requested operation terminated abnormally: Unknown page type.
552 requested file operation terminated abnormally: Excess storage allocation (for current directory or dataset).
553 The requested operation was not performed. The file name that is not allowed.
Common FTP status Codes and why
150-FTP uses two ports: 21 for sending commands and 20 for sending data. Status code 150 indicates that the server is ready to open a new connection on port 20 and send some data.
226-The command opens a data connection on port 20 to perform operations, such as transferring files. The operation completed successfully and the data connection was closed.
230-After the client sends the correct password, the status code is displayed. It indicates that the user has successfully logged in.
331-The status code is displayed after the client sends the user name. The status code is displayed regardless of whether the user name provided is a valid account on the system.
426-The command opens the data connection to perform the operation, but the operation has been canceled and the data connection has been closed.
530-The status code indicates that the user cannot log on because the user name and password combination are invalid. If you are logged on with a user account, you may type an incorrect user name or password, or you may choose to allow only anonymous access. If you log on with an anonymous account, the configuration of IIS may deny anonymous access.
550-The command was not executed because the specified file is not available. For example, the file you want to get does not exist, or you are trying to put the file to a directory where you do not have 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.