ajaxStart() showing loading message doesn't seem to work....

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-05-05T07:18:47Z Indexed on 2010/05/05 7:28 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

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...&nbsp
</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....

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ajax