您可以尝试使用以下html-
<body onload="loadingAjax('myDiv');"> <div id="myDiv"> <img id="loading-image" src="ajax-loader.gif" /> </div></body>和脚本-
<script>function loadingAjax(div_id) { var divIdHtml = $("#"+div_id).html(); $.ajax({type: "POST",url: "script.php",data: "name=John&id=28",beforeSend: function() { $("#loading-image").show();},success: function(msg) { $("#"+div_id).html(divIdHtml + msg); $("#loading-image").hide();} });}</script>


