当前位置: 代码迷 >> JavaScript >> js 加载其余页面的信息
  详细解决方案

js 加载其余页面的信息

热度:109   发布时间:2012-11-23 00:03:43.0
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;
      });
  相关解决方案