I would like to show a loading gif by doing document.getElementById("loading").classList.remove("hidden")
while this ajax called is in progress. And I would like to add the class hidden
again soon after the ajax is done and before alert(responce)
What kind of code should I put on my code? p.s. the rest of code is working correctly now. Thanks.
function move(moveName, gameID, playerID){
var moveNameID = moveName.replace(/\s+/g, "").toLocaleLowerCase();
var postParams = { 'guid' : gameID,
'pid' : playerID,
'movename' : moveNameID};
var ajaxPromise = new AjaxPostPromise("url", postParams);
ajaxPromise
.then( function(response) {
alert(response)
})
.catch( function(errorMessage){
alert(errorMessage);
});
}