Skip to content

Instantly share code, notes, and snippets.

@aruizca
Created March 12, 2013 01:58
Show Gist options
  • Save aruizca/5139667 to your computer and use it in GitHub Desktop.
Save aruizca/5139667 to your computer and use it in GitHub Desktop.
displaying spinner on ajax request example
var x,y;
$(function () {
$('body').mousemove(function (e) {
x = e.pageX;
y = e.pageY;
});
$(document).ajaxStart(
function (e) {
$('#spinner').css('left', x);
$('#spinner').css('top', y).show();
$('body').css('cursor', 'wait');
}).ajaxComplete(function () {
$('#spinner').hide();
$('body').css('cursor', 'auto');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment