How to solve the problem of Ajax cross-domain

Source: Internet
Author: User
Tags return domain
Ajax| Solution | problem | cross-domain

Ajax (Dynamic Web site static) accompanied by the Goole, more and more sites began to use, in the open large Ajax (Dynamic Web site static) program will encounter a lot of problems, mainly in the following areas:

1. Cross-browser issues
2. Historical Retreat Status Problem


3. Cross-domain issues

Cross-browser issues because there are many new Kaiyuan frameworks that have been solved, we don't have to worry about that.

History back State problem we can use an array to save the history, and then the data village to the historical object, and can be resolved, and there are many Kaiyuan framework to support, so the problem is not very big.

Cross-domain problems are not a good solution, but there is a way to give some basic solutions for everyone to choose from:

1. Using agents, you can use the web-side program to write the agent, all the Ajax (Dynamic Web site static) requested data forwarding, Web programs can make PHP (as the current mainstream development language), JSP (Sun Enterprise Application preferred), ASP and other programming languages. I believe you must be very familiar with this way, here is not a detailed introduction.
2. Use the way of the IFRAME to set the refresh of the leaf, this way is only to obtain data to display, and can not really and get the data to interact, transform the cost of the Dynamic Data page, is not very desirable, the application is not a lot, I also ignore not to discuss.
3. The proxy function of using Apache (the most popular Web server platform for UNIX platforms) is mainly the direction of Apache (the most popular Web server platform for UNIX platforms), or the URL from the orientation, you can also put other sites directly on their own site, Such a way may be the question of AIA, more than nine introduced, interested in this has to practice the following.
4. Using the script label, in this way, you can use real Ajax (Dynamic Web site static) to cross the domain, and can use the returned data, swearing very simple, in our background program after processing to the results are directly in the JavaScript way to return, Using variables that return data directly in our HTML can be a simple example
We use the HTML foliage



New Document










/html>

Background program

Get.php (as the current mainstream development language)
Eche ' var XML (standardization is getting closer) = "ASDF";
When you click on the button will go to the server that you need JS, but add to the completion of their own use of variable XML (standardization is getting closer), run the code after you will get a dialog box to display asdf;




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.