[英]Javascript that reads in a url takes a certain div tag from the html page and place it in another page.
Hi I'm kind of new to this stuff, but I would like to be able to input a file path or url then the javascript will read a certain div tag then takes it from that html page and place it in another page which I can also input the url or file path. 嗨,我是这个东西的新手,但是我希望能够输入文件路径或url,然后javascript将读取某个div标签,然后从该html页面中获取它,并将其放在另一个页面中,我可以还输入网址或文件路径。 Is this possible?
这可能吗? and can anyone put me on the right track?
谁能把我放在正确的轨道上?
Using Jquery and AJAX you can specify a file path and read a certain div tag's HTML. 使用Jquery和AJAX,您可以指定文件路径并读取特定div标签的HTML。 I am not sure that you can place that html into a different page other than the one you are on.
我不确定您是否可以将html放到您所在的页面之外的其他页面中。
$.ajax({
url: 'ajax/test.html',
success: function(data) {
$('.result').html($(data).find("#myDiv").html());
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.