My JQUERY function isn't working properly
Hello ! i have a Jquery Function wich i use to refresh a DIV after doing some updates First you click on the Icon wich calls the AJAX functions. It first update an SQL DataTable then switch the icon's Color. Then i reload the DIV wich contains the datas from the updated table. The fact it's the reloading seems to not work properly, sometime it works sometimes it don't, may it be a probleme with the delay? i give you the Code Below (personnal work, no sensitive datas) function booking_game(idGame, idUser, plaftorm, id, color) { if(id.classList.contains('text-' + color)){ $.ajax({ type: "POST", url: "include/cancelBook.query.php", data: { idGame: idGame, idUser: idUser, plaftorm:plaftorm } }); } else{ $.ajax({ type: "POST", url: "include/book.query.php", data: { idGame: idGame, idUser: idUser, plaftorm:plaftorm } }); } changeColor(id,color); $.ajax({ type: "GET", url: "include/listBooking.php", data: { idGame: idGame }, success: function(response) { $(idGame).load(response); } }); } thanks a lot