weixin_33749242 2012-09-05 05:39 采纳率: 0%
浏览 28

启用同一班级的最后一个div

I am making an ajax call to get more results and get them appended to the existing ones in the same page. While the contents are fetched, i need to show a scrolling spinner every time requests are send. In order to achieve this i go on adding a div at bottom of results fetched like this:

<div class="loader" style="display:block"></div>

And i am trying to show the spinner using the below code:

beforeSend: function() 
{
      $('#loader:last-child').html('<img src="/graphics/loading.gif" alt="Wait" />');
}
complete: function()
{
      $('#loader:last-child').html('');
}

But i am not able to get the spinner effect, it is not at all shown on the page(results are though fetched).

Please help me in getting it corrected. Any other thoughts to have the spinner effect are also appreciated.

EDIT: I have removed quotes as they wre in my perl code. sorry for that.

  • 写回答

7条回答 默认 最新

  • larry*wei 2012-09-05 05:42
    关注

    Put a space in <imgsrc so that its <img src

    Your selector should be $('.loader:last-child') since loader is a class not an id. (Use . instead of #)

    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站