开发者

jQuery .load() call doesn't work in Firefox - why?

开发者 https://www.devze.com 2023-01-06 00:11 出处:网络
I\'m a newbie programmer working with jQuery and wonder if anyone can help me out. Essentially, I\'ve created some html for a social button\'s section on our articles.

I'm a newbie programmer working with jQuery and wonder if anyone can help me out.

Essentially, I've created some html for a social button's section on our articles.

I've uploaded that with the aim of using jQuery's .load() function to pul开发者_运维技巧l it into every article.

It works in IE7, but not in Firefox or Chrome. Can anyone help fix it?

<script type="text/javascript">
$(document).ready(function(){

$('#shareBlock').load("http://i.thisis.co.uk/275563/binaries/sharebox.html");

});
</script>


Based on the URL in your load() and the nature of the issue I believe you have a problem with same origin. If your URL is external/violates same origin in some way you will not be able to load it in this manner.

For more details check this out - http://en.wikipedia.org/wiki/Same_origin_policy


Can you please show me how did you load jquery library in <head>?

I had the same problem and I solved it by repacing /> to end script tag with </script> end tag.

More here: http://javaxtendsolutions.wordpress.com/2011/01/24/jquery-doesnt-load-in-firefox/

0

精彩评论

暂无评论...
验证码 换一张
取 消