使用jquery将外部html文件加载到div [英] load external html file to div using jquery
本文介绍了使用jquery将外部html文件加载到div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了一个有很多工具提示的html页面。每个工具提示都有一个画廊,因为它不可能使用多个具有相同ID的画廊,所以我打算为画廊创建6个不同的html文件,然后将画廊加载到我的默认页面。
我需要为每个div调整html页面。
我试过.load,但它不起作用。
< div id =flrmain>需要调用这个div内的html文件。< div>
请协助。
解决方案
$。get('test.html')
.success(function(data){
$('div.content') .html(data);
});
编辑 p>
如果您需要它用于特定的 div
,请替换'div.content'
与'#flrmain'
。
I am using a html page which has many tooltips. each tooltip has a gallery, since it is not possible to use multiple gallery which has same id, I am planning to create 6 different html files for gallery, then load the gallery into my default page.
I need to cal the html page for each div. I tried .load but it is not working.
<div id="flrmain">need to call the html file inside this div.<div>
Please help.
解决方案
$.get('test.html')
.success(function(data) {
$('div.content').html(data);
});
EDIT
If you need it for that specific div
, replace 'div.content'
with '#flrmain'
.
这篇关于使用jquery将外部html文件加载到div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文