views:

92

answers:

3

Hello, Is it possible to load content from an external page (not relative) into div using jquery? I mean here by external page is another web application like for example: http://www.yahoo.com There is the code:

$("#externalContent").load("http://www.yahoo.com", function () {
    alert("loading finish");
});

when I use firebug I got this result: Firebug result

you see here, i highlighted the response code, it's 200 which means OK, but still no content loaded. DOES anyone know the reason?

+1  A: 

In a standard security context, you cannot access data on a remote URI without using a trick such as JSON-P or proxying the data through your own server. The same origin policy gets in the way.

David Dorward
+1  A: 

You can send a request to your script on the same domain that will grab yahoo.com content on a server side (not client side) and return it to you.

silent
This could be a solution but I will use iframe rather than this method. Thank you all guys
Pr0fess0rX
+2  A: 

To illustrate 'cross-domain', the following table gives the overview of typical outcomes for checks against the URL "http://www.example.com/dir/page.html". alt text

source

status==200 would just mean that the url exists...

Reigel