如何将另一个页面的div附加到当前页面的div? [英] How to append a div from another page to a div from the current page?
本文介绍了如何将另一个页面的div附加到当前页面的div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将另一个页面的div附加到当前页面的div?
我知道.load
,但是有没有办法去append
?
How to append a div from another page to a div from the current page?
I know the .load
but is there a way to append
?
$.ajax({
type: "POST",
url: '/script/validate_email.php',
data: {i_email:i_email},
cache: false,
success: function(){
$("#a_loader_i").hide();
$email_valid = true;
}
});
除了附加整个php,我希望能够附加php中的某个div(使用其ID)
Instead of appending the whole php, I want to be able to append a certain div from the php (using its ID)
推荐答案
您可以加载到一个空的DIV中:
You can load into an empty DIV:
var yourDiv = $('<div>').load('/my/url/tocontent.html #specificcontent', myCallbackFunction);
然后将其附加到另一个元素:
And then append it to another element:
$('#result').append($(yourDiv));
这篇关于如何将另一个页面的div附加到当前页面的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文