我使用Ajax.BeginForm
表单帖子。
但是当我快速点击按钮时。处理工作不止一个。工作时RefreshPosts();
脚本将重置表单元素。
控制器:
public string SharePost(FormCollection form)
{
var singleUser = _repUsers.GetUserWithCookie(GetCookie(_set.userCookieName));
string content = Request.Form["statusText"];
_opPosts.AddPost(content, singleUser.UserId);
_opUsers.AddFeed(1, singleUser.UserFirstName, singleUser.UserSurName);
Session["PostDate"] = DateTime.Now;
return "Başarıyla paylaştık." + "<script> refreshPosts(); </script>";
}
查看:
@using (Ajax.BeginForm("SharePost", "Post", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result", OnSuccess = "postSuccess", LoadingElementId = "loading" }))