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 %>
精彩评论