Search code examples
jqueryajaxhtmljquery-load

How to load content from external page using jQuery?


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 http://devville.net/blog/wp-content/uploads/2010/05/jQuery-LoadExternalContent.png

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


Solution

  • 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.