At first I want request a whole page:
起初我想要一整页请求:
$.ajax({
type: "get",
url: "Test.aspx",
dataType: "html",
success: function (html) {
$(html).appendTo($("#contain"));
},
});
the whole page element will append to the div#contain,include the css,js script effect ,
整个页面元素将附加到div#contains,包含css,js脚本效果,
but when I request part of the page 's elements,like :
但是当我要求页面的一部分元素时,例如:
$.ajax({
type: "get",
url: "Test.aspx",
dataType: "html",
success: function (html) {
$(html).find("div.test").appendTo($("#contain"));
},
});
the resault is that div#conntain only get the element's pure inner html,like some text,without any css or js effect……
resault是div#conntain只获取元素的纯内部html,就像一些文本一样,没有任何css或js效果......
so how can I get parts of the page 's element' include css and js effect?or it is just impossible……
那么我如何才能获得页面元素的部分'包括css和js效果?或者它只是不可能......
1 个解决方案
#1
0
first I still don't konw why the situation would happened,but the comment above is right,if I define CSS and JS globally,this could be solved more or less ,the CSS could work ,but the js seems still not……
首先我还是不知道为什么情况会发生,但上面的评论是正确的,如果我在全局定义CSS和JS,这可以或多或少地解决,CSS可以工作,但js似乎仍然没有......
#1
0
first I still don't konw why the situation would happened,but the comment above is right,if I define CSS and JS globally,this could be solved more or less ,the CSS could work ,but the js seems still not……
首先我还是不知道为什么情况会发生,但上面的评论是正确的,如果我在全局定义CSS和JS,这可以或多或少地解决,CSS可以工作,但js似乎仍然没有......