Jquery ajax load div content from Web Server to Local Server
this code work fine on localhost,when loading div from one blog to another(both on localhost),but when try to load from blog that is on internet to another blog(localhost),it doesn't work,what could be the problem?Here is the code.
<?php
$urlPage = 'http://www.somepage.com/'; //dont work
//$urlPage = 'http://localhost/myBlog1/'; //work fine
?>
<script type="text/javascript">
var addr;
jQuery(document).ready(function($){
addr = '<?php开发者_如何学JAVA echo $urlPage; ?>';
$.ajax( {
url: addr,
success: function(html) {
$(".divToLoadContent").append($(html).find('#sidebar ul').html());
}
});
return false;
});
</script>
<style type="text/css">
.divToLoadContent {
margin:0px;
border: 1px solid lime;
width: 100%;
}
</style>
<div class="divToLoadContent">
</div>
http://en.wikipedia.org/wiki/Same_origin_policy
精彩评论