比如有一个Register按钮,当按钮被点击时,它会向Action Register发送一个ajax请求做数据库处理,然后发送验证邮件。
$.ajax({
url: "/Register",
type: 'POST',
error: function(xhr) {},
success: function(data) {
//after success, change the button color
}
});
[HttpPost]
public ActionResult Register() {
//database processing
......
//send email
//(this step takes long period of time, the button wait for long time to change the color, how can i solve this issue?)
}