开发者

Jquery Ajax with ruby on rails (show loading message on a div)

I need to show a message as loading until the data gets returned and updates in my div.. How do I do it.. I could update the data on complete..

<%= javascr开发者_JAVA技巧ipt_tag do %> jQuery(function($) { $("#calendar_tab").click(function() {

$.ajax( { url:'/calendar/showcal/<%=@space.id%>', type:'GET', dataType:'script', data:{month:'9'},

                complete: function(data)
                {

                }

            });
        });

    });

<% end %>


You can use beforeSend callback to initiate the loading.... statement or any other animation and can dismiss it on complete callback function.

<%= javascript_tag do %> 
  jQuery(function($) {
    $("#calendar_tab").click(function() {
      $.ajax({
        url:'/calendar/showcal/<%=@space.id%>',
        type:'GET',
        dataType:'script',
        data:{month:'9'},
        **beforeSend: function() { 
        },**
        complete: function(data) {
        }
     });
  });
});
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜