日期:2014-05-16  浏览次数:20328 次

js 加载其他页面的信息
加载其他页面的内容
方法一:
<script type="text/javascript">
    $(function (){
        $('a.dialog').click(function() {
            var url = $(this).attr('href');
            var dialog = $('<div style="display:none"></div>').appendTo('body');
            dialog.load(url, {}, function (responseText, textStatus, XMLHttpRequest)                       {
                dialog.dialog({
                    close: function(event, ui) {
                        dialog.remove();
                    }
                });
            });
            return false;
        });
    });
</script>

优化:
$('a.popup').click(function() {
        $("object").css("visibility", "hidden");
        var url = $(this).attr('href');
        var dialog = $('<div style="display:none"><div id="dialog-content">加载中...</div></div>').appendTo('body');
        dialog.dialog({
          title: "SFP监控图",
          height: 650,
          width: 800,
          modal: true,
          close: function(event, ui) {$("object").css("visibility", "visible");dialog.remove();}
        });
        $("#dialog-content").load(url);
        return false;
      });