我需要重新加载 div
而不重新加载整个页面以提高效率。
我试过这个代码:
$('#mydiv').load(document.URL + '#mydiv');
但它只是在我的 div
中重新加载我的整个页面。
我也试过这个:
var auto_refresh = setInterval(
function (){
$('#background').load('dashboard.php').fadeIn("slow");
}, 1);
但两者都不是很有效,因为我需要“实时”或最接近实时刷新。
知道我该怎么做吗?
答案 0 :(得分:-1)
你可以使用ajax。
$.ajax({
url : 'dashboard.php',
type : 'GET',
success : function(data) {
$('body').replaceWith(data);
}
});