I user jquery.ajax call to controller of asp.net mvc... I would like to show a loading indicator.. I tried this but that doesn't seem to work...
<div class="loading" style="padding-left:5px; margin-bottom:5px;display:none;">
Loading... 
</div>
and my jquery ajax call looks like this,
function getMaterials(currentPage) {
$.ajax({
url: "Materials/GetMaterials",
data: {'currentPage': (currentPage + 1) ,'pageSize':5},
contentType: "application/json; charset=utf-8",
global: false,
async: false,
dataType: "json",
success: function(data) {
var divs = '';
$("#ResultsDiv").empty();
$.each(data.Results, function() {
//my logic here....
$(".loading").bind("ajaxStart", function() {
$(this).show();
}).bind("ajaxStop", function() {
$(this).hide();
});
}
});
return false;
}
My loading indicator doen't seem to showup.. ANy suggestion....