如何重装DIV内容无需刷新整个页面 [英] how to reload DIV content without refreshing whole page
本文介绍了如何重装DIV内容无需刷新整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想替换DIV的内容与我得到的内容。之后,我做一个GET请求来利用AJAX服务器。
$。阿贾克斯({
键入:GET,
网址:http://127.0.0.1:8000/result/?age="+ ageData +&放大器;有时=+
occasionData +与&关系=+ forData +#,
成功:函数(){
$(#testDIV)负荷()。
}
});
testDIV是的div与我想取代来自服务器的内容得到了ID。
解决方案
$。阿贾克斯({
键入:GET,
网址:ht.tp://127.0.0.1:8000/result/?age="+ ageData +&放大器;有时=+
occasionData +与&关系=+ forData +#,
成功:函数(响应){
$(#testDIV)的HTML(响应)。
}
});
I want to only replace the DIV content with the content i get. After i make a get request to the server using ajax.
$.ajax({
type: "GET",
url: "http://127.0.0.1:8000/result/?age="+ ageData +"&occasion="+
occasionData +"&relationship="+ forData +"#",
success: function () {
$("#testDIV").load();
}
});
"testDIV" is the id of the div with which i want to replace the content got from the server.
解决方案
$.ajax({
type: "GET",
url: "ht.tp://127.0.0.1:8000/result/?age="+ ageData +"&occasion="+
occasionData +"&relationship="+ forData +"#",
success: function (response) {
$("#testDIV").html(response);
}
});
这篇关于如何重装DIV内容无需刷新整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文