Reputation: 5039
I have an html page, which is a dynamically created asp/aspx page on http://host2.mydomain.com. I have no control over the html page. I cannot modify it in any such way. I cannot modify this page; so, setting document.domain is out of the question, unfortunately. This html page is compiled by a 3rd-party vendor and the code is close-source; I cannot view it or change it. I want to retrieve and display this page on http://host1.mydomain.com/page1.jsp using Ajax.
FYI: host1 is being served by IIS 7 and Apache Tomcat (for JSP pages). And host2 is using IIS 7 and ASP.
How can I retrieve this page using a Ajax POST request?
Thank you.
Upvotes: 0
Views: 246
Reputation: 4459
You can't with a standard AJAX call due to cross-domain policies, you would have to use JSONP or a form of JSONP http://en.wikipedia.org/wiki/JSONP
Also, a common "gotcha" is that the cross-domain policies prevent secure to non-secure ajax as well. So a https://
page cannot request a http://
page and vice versa/
Upvotes: 1
Reputation: 12053
you write a server-side script to retrieve the page contents, then you use Ajax to request your script
Upvotes: 1
Reputation: 1770
You are just going across subdomains so can do it using an iframe, look to this question - A question about cross-domain (subdomain) ajax request
The solution referenced: http://www.tomhoppe.com/index.php/2008/03/cross-sub-domain-javascript-ajax-iframe-etc/
Upvotes: 1
Reputation: 2064
By setting proper CORS headers if you are using modern browsers. Have a look here
Upvotes: 1
Reputation: 3965
YQL
http://developer.yahoo.com/yql/
and
JSON-P
http://en.wikipedia.org/wiki/JSONP
Upvotes: 1