How do i make an ajax request synchronous?
I have a form which needs to be submitted. But it needs to be submitted only when the user enters the correct password.
The below is a working example. Add async:false.
async:false
const response = $.ajax({ type:"POST", dataType:"json", async:false, url:"your-url", data:{"data":"data"} }); console.log("response: ", response);