更新时间:2023-12-05 07:51:04
尝试使用:
$("#divID").html("<img style='position:absolute' src='path/to/the/ajax_loader.gif'>");
如果您使用ajax:
function sendAjax()
{
$("#divID").html("<img style='position:absolute' src='path/to/the/ajax_loader.gif'>");
// you ajax code
$("#divID").html(ajaxResponse);
}
您还可以使用 document.getElementById('divID ').innerHTML
而不是 $(#divID)。html()
。它也工作正常
you can also use document.getElementById('divID').innerHTML
instead of $("#divID").html()
. its also work fine
如果你使用这种方法,不需要使用CSS隐藏div。它在ajax响应后自动删除。
If you use this method, doesn't need to hide the div using css. its automatically remove after the ajax response.