I have an AJAX code, where you request that the request to call a AJMX on a remote server fails :
function loadXMLDoc () {if (window.XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera, Safari xmlhttp = New XMLHttpRequest (); } Else {// code for IE6, IE5 xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } Xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4 & xmlhttp.status == 200} {document.getElementById ("myDiv"). InnerHTML = xmlhttp.responseText;}} Xmlhttp.open (" GET "," http://www.google.com ", true); xmlhttp.send ();}
What can I do to solve it?
It seems that you have bumped it on. You can get your absolute http: // www. Instead of a google.com
path, you must use a relative path.
As a possible solution, if you are using Apache, it is a lot easier if you use it in your AJAX app. Will allow you to use relative paths in anger, while the HTTP server will act as a proxy to a "remote" location.
The default configuration instructions for setting a reverse proxy in mod_proxy is proxypace, you will usually use it as follows:
ProxyPass / Web Services / http: // Third-party.com/web-services/
In this case, the browser will request the /web-services/service.xml
, but the server < Code> http://third-party.com/web-service/xml.aspx .
Another common solution will be to use.
Comments
Post a Comment