开发者

Jquery ajax load div content from Web Server to Local Server

开发者 https://www.devze.com 2023-01-03 18:12 出处:网络
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

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

0

精彩评论

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