Ajax request return cannot reach Success,statustext: "Error" status:0 readystate:0

Source: Internet
Author: User

Problem background:

Mistakenly using <from metod= "POST" action= "/test" ></form> form

Use AJAX data in JS code to submit requests again to the background eg:url: "/test2"

Problem Error:

The background correctly returns the content of the "/test2" request, but jumps directly to the AJAX error function, viewing the error as: statustext: "Error" status:0 readystate:0

Error causes: Both form submission and AJAX data requests are used, resulting in a return failure.

Workaround:

1, use form form or use Ajax one.

2, the Internet seems to use Preventdefault () method to solve the problem, when the problem is more complex can choose this one, the specific solution to be followed by learning.

Reference Links:

http://www.justinball.com/2013/02/25/jqxhr-returning-readystate-0-and-status-0/

Http://www.w3school.com.cn/jsref/event_preventdefault.asp



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.