The javascript-Ajax request enters error. how can this problem be solved?

Source: Internet
Author: User
{Code ...}

$. Ajax ({url: rootPath + "/doRegister", type: "post", data: dates, contentType: "application/x-www-form-urlencoded; charset = UTF-8 ", timeout: 30000, dataType: "json", cache: false, error: function (e) {console. log (4441); console. log (e) alert ("a user registered network connection error ~ "); Window. location. reload () ;}, success: function (obj) {console. log (4442) // restart the server. the token is invalid. obtain the token again. if (typeof (obj) = 'undefined' | obj = null) {window. location. reload ();} if (obj. rs) {window. location. href = rootPath + "/loginRule";} else {alert (obj. msg); $ ("# _ form_token_uniq_id "). val (obj. token. token );}}

Reply content:

$. Ajax ({url: rootPath + "/doRegister", type: "post", data: dates, contentType: "application/x-www-form-urlencoded; charset = UTF-8 ", timeout: 30000, dataType: "json", cache: false, error: function (e) {console. log (4441); console. log (e) alert ("a user registered network connection error ~ "); Window. location. reload () ;}, success: function (obj) {console. log (4442) // restart the server. the token is invalid. obtain the token again. if (typeof (obj) = 'undefined' | obj = null) {window. location. reload ();} if (obj. rs) {window. location. href = rootPath + "/loginRule";} else {alert (obj. msg); $ ("# _ form_token_uniq_id "). val (obj. token. token );}}

I have encountered this problem just now, because my service is suspended.

If the error code returned by f12 is missing, check whether the error code 400 is returned for the request ......

You should put response to facilitate error locating.

You are incomplete. because it is incomplete, it can only be estimated that the error 400 is returned, or the data returned at the interface is not in the desired data format. And you didn't cut the response header, that is, the response headers, so I'm sorry, this can only be preliminarily estimated that there is no response!

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.