javascript - Display loading while retrieving data using Ajax method -
i using ajax, takes time load data database therefore need find way display (loading...) while data not yet complete. below sample code, , looking event while data still in process.
$.ajax({ type: "post", url: "some.php", data: "name=john&location=boston", success: function(data){ $('#para').html(data); } });
it simple..
before call ajax start loading image..& after success hide image eg :
$.fancybox.showloading(); $.ajax({ type: "post", url: "some.php", data: "name=john&location=boston", success: function(data){ $.fancybox.hideloading(); $('#para').html(data); } });
here
$.fancybox.showloading()
is function in have property of displaying loader,
Comments
Post a Comment