如何执行在客户端等待服务器响应时运行的函数?这是我的代码。我查找并找到了一个 .load() 函数,但它是如何适应的呢?任何帮助都会很棒!谢谢
$.ajax({
type: "POST",
url: "mail.php",
data: {name: name.val(), email: email.val(), phone: phone.val(), subject: subject.val(), message: message.val()}
}).done(function(){
alert("Your message was sent. We will be in contact with you shortly.");
window.location="index.html";
});