阿贾克斯附加负载 [英] Ajax append load
问题描述
它必须是jQuery的
我的文件text.html 6格在(A,B,C,D,E,F)
在另一个文件中,我有一个div,我喜欢它来填充A + B + C + D + E +内容˚F成单一的div
我已经尝试.load =,但是B remplace一个 我已经尝试追加,但我需要一个临时VAR
所以现在我被困
这code从文件textes.html ... DIV#A的内容并把内容放到股利#right,但第二libe REMPLACE右一,右b
内容我想追加内容A + B NOT A对B
$(文件)。就绪(函数(){
变种临时=负载('textes.html #nicolas');
$('#右)追加(TEMP)。
变种临时=负载('textes.html #antoine');
$('#右)追加(TEMP)。
。
。
。
。
返回false;
});
这code是背后究竟应该工作的想法,但我不能让一个AJAX .load()将内容加载到一个变量,将内容附加到div ...
<脚本类型=文/ JavaScript的>
$(文件)。就绪(函数(){
$阿贾克斯({
网址:textes.html
缓存:假的,
成功:函数(HTML){
$(#右)追加(HTML)。
}
});
});
< / SCRIPT>
这code加载整个HTML文件,我想只得到某些选定DIV#
$(文件)。就绪(函数(){
$获得(textes.html功能(数据){
$(#右)追加($(#尼古拉斯,数据))结束()追加($(#安托万,数据))。;
},HTML);
});
it must be jquery
I have file text.html with 6 div in (a,b,c,d,e,f)
In another file i have a div, i like it to populate the content of a+b+c+d+e+f into that single div
I have try .load = but b remplace a i have try append, but i need a temp var
so now i am stuck
That code get the content from the file textes.html ... div #a and put the content into div #right, but the second libe REMPLACE the content of right a with right b
I like to append the content a + b NOT a over b
$(document).ready(function(){
var temp = load('textes.html #nicolas');
$('#right').append(temp);
var temp = load('textes.html #antoine');
$('#right').append(temp);
.
.
.
.
return false;
});
that code is the idea behind what should work, but i cannot make a ajax .load() to load content into a variable to append the content to the div...
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: "textes.html",
cache: false,
success: function(html){
$("#right").append(html);
}
});
});
</script>
That code load the WHOLE html file, i like to get only some selected DIV #
$(document).ready(function(){
$.get("textes.html",function(data){
$("#right").append($("#nicolas",data)).end().append($("#antoine",data));
},'html');
});
这篇关于阿贾克斯附加负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!