2

你能告诉我在哪里以及如何放置 ajx loading.gif 吗?我的html代码如下

<div class="searchbox">

    <input  id="Search" onkeyup="searchKeyUp(event)
     " name="Search" class="searchtextbox"/>

</div>
</td>

 <td width="57"><br> <img onclick="search(); return false;" style=" cursor:pointer" eight="30" onmouseover="this.src='images/j3.jpg'" type="image" src="images/j1.jpg"    onmouseout="this.src='images/s1.jpg';" alt="" width="57" ></td>
 </tr>
 </table> 
 <div> 
 <table cellspacing="0" cellpadding="0" border="0">

  <tr valign="left">

 <td><div class="resultCss" content="tableId" id='resultDiv'>

 </div></td>
 </tr>

        </table>   
4

3 回答 3

0

在您的 AJAX 请求开始之前,显示 ajax_load.gif 并在它结束之后将其删除。

提示:确保一次只有 1 个 AJAX 请求发送到您的服务器,例如https://www.buxfer.com

于 2010-01-06T14:12:47.747 回答
0

建立在您想要拥有它的位置并在其上显示:无。在 AJAX 调用之前的 search() 中,编辑 display:none 以再次阻止和隐藏图像 onSuccess 关闭 AJAX 功能。

于 2010-01-06T14:33:32.683 回答
0
  1. 您需要将 gif 文件放置到任何适当的位置并设置“display:none;”
  2. 你可以使用我基于 jQuery 的函数。它会在每次 ajax 调用时自动显示或隐藏微调器。

函数 simpleAjax(pageUrl, divId, spinnerId, formId, isFormEnabled) { var dataVar =''; var d = 新日期();if(isFormEnabled) dataVar = $('#'+formId).serialize();

$.ajax(
{
    type: 'GET',
    url: pageUrl,
    cache:false,
    data:dataVar,               
    success: function(response){ $('#'+divId).html(response); $('#'+spinnerId).hide(); },

    beforeSend: function(){ $('#'+spinnerId).show();},

    error: function(m){ alert(m); },

    complete: function(){}
});

}

于 2011-02-14T10:53:41.920 回答