There is such ajax function
function searchPromokode(){ var promokode= $(".promokode").val(); if(promokode.length>13){ $.ajax({ type: 'POST', url: "/search/promokode", data: "promokode="+promokode, success: function(answer) { if (answer){ alert('ΠΡΠΎΠΌΠΎΠΊΠΎΠ΄ Π°ΠΊΡΠΈΠ²ΠΈΡΠΎΠ²Π°Π½'); } else { alert('ΠΡΠΎΠΌΠΎΠΊΠΎΠ΄ ΡΠΆΠ΅ Π±ΡΠ» Π°ΠΊΡΠΈΠ²ΠΈΡΠΎΠ²Π°Π½'); } } }); } } I want to put a loader let's say
<div class="loader"></div> .loader{ display:none; } There are two questions at what point to put this loader in the ajax request. And second, I certainly understand that we all want to speed up the process of all the work, but as I understand it, the processing will be very fast, less than a second and the user will not see the loader, sorry for the dumb question BUT how to set a delay of 1-2 seconds so that the loader spins)