views:

106

answers:

3

Hi,

You know the browser restrictions which disallow remote domain load, ie making this not work:

$("#verizon").load("http://verizon.domain.net/?var=rscms&tan=0.9"); 

Is there any way around that? I'd rather not have to iframe the content

+1  A: 

You can use a local script written in C#, PHP, or whatever you have access to that can read the contents and relay them back to the jQuery request.

$.post("remote-fetch.php", {url:"http://verizon.com"}, function(results) {
  alert(results);
});

That would call a local php script that would resemble the following:

print file_get_contents($_POST["url"]);
// whatever is printed here will be alerted in our jQuery code

Of course you would want to have some more logic within your server-side script than this. My example is merely just a concept of how you could acheive the results you desire.

Jonathan Sampson
+1  A: 

Some sites have JSONP APIs. If the site doesn't have an API for cross-domain requests, I think the best you can do is proxy the content through your server.

Annie
A: 

You can build a simple proxy in PHP or other language that takes the URL as a parameter does curl or the like to return the data to your JavaScript. Just host the proxy on the same domain.

Jeff Beck