在Ajax.BeginForm上显示加载器提交

在提交表单时,显示加载程序和禁用按钮的最佳方法是什么:

@using (Ajax.BeginForm(MVC.Account.Login(), new AjaxOptions { OnSuccess = "onLoginSuccess" }, new { @id = "loginForm" })) { 

@HeelpResources.AccountLoginViewLoginButtonLabel

}

加载程序映像文件是

  

也许使用BeginForm中的OnBegin来显示加载器和OnComplete来隐藏它? 但是我怎样才能改变图像呢?

任何消化找到优质的免费装载机?

谢谢

将加载图像标记放在div标记内,如下所示:

 

在你的CSS文件中:

 div#loading { display: none; } 

而且,在你的forms:

 @using (Ajax.BeginForm(MVC.Account.Login(), new AjaxOptions { OnSuccess = "onLoginSuccess", LoadingElementId = "loading", OnBegin = "onLoginBegin" }, new { @id = "loginForm" })) { 

@HeelpResources.AccountLoginViewLoginButtonLabel

}

并且,在您的视图中添加一个脚本: