Local host as a server to resolve Ajax cross-domain request access to data

Source: Internet
Author: User

In recent days to learn Ajax, want to test the Ajax sample, because before the server leased in Ali expired, and then want to let the local host server and do the client, just simple test, should be OK.

So, download the xampp, download the URL http://www.apachefriends.org, only need to unzip the installation of a fool to be able to.

Locate the directory where the software is installed, click Xampp-control.exe and then launch the Apache service, open the browser, enter localhost in the address bar, appear as a tablet, indicating that the installation started is no problem

Now write two simple text, a TXT file, an HTML code:

As follows:

TXT text:

HTML file:

Put these two files in the xampp/htdoc/directory, double-click the HTML file, under Chrome and IE, respectively, the following error appears:

The general meaning is that AJAX requests access to server data across domains failed or was denied access, I looked up the internet, and saw a lot of ways to add the boot parameters to chrome, such as--disable-web-security. But not all the same, and the experience is not very good, and then directly in the address bar input localhost/1.html Two kinds of browsers are displayed as follows:

There is a more concise way to open directly with Firefox, but also to achieve the purpose

Local host as a server to resolve Ajax cross-domain request access to data

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.