pattmorter
pattmorter

Reputation: 991

jQuery .load() troubles

I'm messing around with the wonderful world of jQuery (since I eventually want to make good web apps/games) and I got to the .load and .get topics. I saw (here and some other places) that you can insert a page's html into a div if so desired. I attempted this on jsFiddle but the results were what they are supposed to be. What am I doing wrong?

<button id="btn1" type="button">Click!</button>
<div id="box1" style="width: 100px; height:100px"></div>
<div id="box2" style="width: 100px; height:100px"></div>

and

$('#btn1').click(function () {
    $('#box1').load('http://stackoverflow.com');
    $('#box2').load('http://stackoverflow.com');
});

I tried the same code in a bunch of different browsers but still no luck. What am I doing wrong?

Upvotes: 0

Views: 39

Answers (1)

What have you tried
What have you tried

Reputation: 11148

You can't do this due to the Same Origin Policy

You can't load data from domains outside of the calling script

Upvotes: 2

Related Questions