There is already a lot of information online
http://www.xml.com/lpt/a/2005/11 ... idered-harmful.html
http://developer.yahoo.com/javascript/howto-proxy.html
These two websites have relatively complete solutions.
The current methods include the following:
Application Proxies: This must be done through background scripts, such as PHP. The essence is to use Ajax to read to trigger local PHP, then use PHP to read external files, and return them to Ajax for display.
Script Tag Hack, or On-Demand JavaScript: Same, through the background Script
Apache Proxy: This method is to configure apache's mod_rewrite or mod_proxy in the Apache server
: As above, through apache settings, I am currently practicing mod_rewrite. After testing, the response time of mod_rewrite is much faster, nearly three times
JSON: This is actually not ajax. It is something I have never seen before. I looked at it for a long time and finally found that it actually simplifies the operation of reading XML with JavaScript, making it easier to parse XML. It cannot be asynchronous and has a specific format. See for details.
http://developer.yahoo.com/common/json.html
http://json.org/
http://del.icio.us/help/json
document.domain: It didn’t work, I’m depressed. If anyone succeeds, let me know:)
Digitally sign your scripts: Didn’t read it, haha. The above mod_proxy method solved it, so I didn’t read it. Later,
if it is your own server group (for example, multiple servers use different domain names, and Ajax in one domain needs to read files in another domain), you can use some other methods, such as using apache to create a virtual directory and pointing to the local A folder, and this file mounts the data folder of another machine, so that it can be read as if it were read locally.
Please be sure to pay attention to the browser cache when testing. When I tested, it always said it was unsuccessful, and the cache was cleared. Then it will be fine. The solution to haha caching can be to add random parameters directly after the url, such as index.php?a_rand_number