tags:

views:

29

answers:

3

Hello,

i've tried jquery .load() function. It is ok when i load files from my server, but i don't know how to load another file from www.

This is my code:

jQuery("#blog").load("/index.html");
jQuery("#blog").load("http://crocoweb.sk/");

The first one is working, the second not. On documentations I can't find how to use http as url parameter here. Please help!

+5  A: 

AJAX is subjected to the same origin policy as a security feature of the browser. So unfortunately the second option will not work by design.

Another option is to do the include on the server.

Vincent Ramdhanie
+1  A: 

You can't load a page coming from another source (domain) via ajax, unless using methods like JSONP. You can check out the ajax jQuery documentation for more information on JSONP.

PJP
A: 

You can add a proxy between your application and the third party domain. This cross domain querying solution works because you're actually loading the content from your own domain.

Dani Cricco