启用同一班级的最后一个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.

查看全部
weixin_33749242
weixin_33749242
2012/09/05 05:39
  • html
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

7个回复