我想显示下面的 ajax 函数对 dom 中的 div 的响应(更新 div)。在不使用重型插件的情况下如何做到这一点?
url: 'http://dowmian.com/xs1/getcam.php',
type: 'GET',
data: {id: <?php echo $cam_id; ?>},
success: function(responseText){
},
error: function(responseText){
}
这取决于你的返回值getcam.php
函数,但您可能正在寻找html()
功能:
$.ajax({
url: 'http://dowmian.com/xs1/getcam.php',
type: 'GET',
data: {id: <?php echo $cam_id; ?>},
success: function(responseText){
$('#update-div').html(responseText);
},
error: function(responseText){
}
});
如果您想附加#update-div
动态地,就像在 ajax 调用之前一样,您可以使用append()
:
$('.container').append($('<div/>').attr('id','update-div'));
参考:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)