Hanfei Sun
Hanfei Sun

Reputation: 47051

why does jQuery.load doesn't work for this page?

I have some inner html that needs to be inserted into a div which has the class modal-body like this:

$(".modal-body").load("http://cistrome.org/finder/util/pure_meta?did=1660");

Though this page can be accessed by browser, it cannot be loaded into the div, when I checked the status of this ajax connection, it says "canceled".

I tried to set the timeout longer like this:

$.ajaxSetup({ timeout: 30000 });

But it doesn't work. Does anyone have ideas about this?

Upvotes: 0

Views: 52

Answers (2)

RRikesh
RRikesh

Reputation: 14381

Your requests should be from the same domain.

You could try to get the contents via PHP:

echo file_get_contents("http://cistrome.org/finder/util/pure_meta?did=1660");

EDIT: Not tested, but you might try this: https://github.com/padolsey/jQuery-Plugins/tree/master/cross-domain-ajax/

Upvotes: 1

Arun P Johny
Arun P Johny

Reputation: 388316

It is because it might be violating same origin policy.

If the domain of your page and the page being loaded are different then the browser security system does not allow to make a ajax request to the resource and load uses ajax to load the content.

Upvotes: 1

Related Questions