Ajax cross-domain request issues

Source: Internet
Author: User

Ajax is not allowed cross-domain requests, today when using bootstap-table, Data-url Use the address is an absolute address, rather than a relative address, so when loading data in error.

Use is http://127.0.0.1 when starting, and it is not allowed to use address http://localhost when requested.

Therefore, use the relative address rather than the absolute address when using AJAX later.

There are a lot of difficulties in finding this problem, and if I start to call Ajax and fail, maybe I can quickly realize that it is an AJAX cross-domain problem. But because you use a control that someone else has written, the interior is encapsulated, so you can't quickly locate the problem. I used the JS debugging tool to track the bootstrap-table internal debugging before I finally realized the problem.

This is the disadvantage of using the control, the control can simplify the work, but when encountering a problem, if it is written in the language, we can use the language itself to solve the problem of the rules. The encapsulation of controls prevents us from being aware of problems quickly.

Ajax cross-domain request issues

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.