Alright, let me share my code with you:
$("#content_Div").ajaxStart(function () {
$(this).css('cursor', 'wait')
}).ajaxComplete(function () {
$(this).css('cursor', 'default')
});
I'm facing a simple issue: the cursor changes to the hourglass immediately on ajaxStart, but it doesn't switch back to default until I move the mouse. Interestingly, I found out that if you click after ajaxComplete, the cursor changes back to default. This happens because after ajaxComplete, clicking triggers the change in cursor, not just moving the mouse. What I really want is for the cursor to change without needing any extra clicks or movements.
My aim is to use the cursor as an indicator for when the request is finished.
Thank you in advance!
For Thomas:
function DF() { //Deletes selected File
if (selectedfiles.length == 0) {
alert("No file selected!");
return
};
var selectedtxt = (selectedfiles.length == 1) ? "'" + basename(selectedfiles[0]) + "'?" : 'these ' + selectedfiles.length + ' files?';
if (confirm("Are you sure you want to delete " + selectedtxt)) {
$.each(selectedfiles, function () {
$.post("server/editfile.php", {
user: user,
oper: "del",
path: "../" + this
}, function (res) {
if (res) {
alert(res);
}
else LT(dirHistory[current]);
});
})
}
}