动态获取html页面的内容,而且取当中的某块元素的方法


$.ajax({
  url: "http://192.168.1.59:8888/app-tpl-webapp/tpl/design.html",
  async:false,
  type:'post',
  dataType:'html',
  success:function(data) {
      console.log("-------------------------------------------------");
      var htmlTextText = $('div').html(data);
      console.log($('div').html(data).eq(1).find("#workspace-body"));
      $('div').html(data).eq(1).find("link,script,style").each(function(index,domEle){
       //$("head").append($(domEle));
       console.log(domEle);
      });
      console.log("-------------------------------------------------");
   //自己主动为布局文件的html中加上id
     }
  });
posted @ 2017-07-28 17:43  claireyuancy  阅读(1416)  评论(0编辑  收藏  举报