MVC表单提交回调
我的母版页中有一个标题,我想在登录页面中启用它。我正在使用 document.onready 事件来完成此操作。但是,当我提交页面并且模型验证失败时,它不会显示标题。当 mvc 验证失败或重新加载页面时,是否有任何 javascript 被调用。
I have a header in my master page which i want to enable it in my login page. I am doing it using document.onready event. But when I submit the page and if the model validation fails, it doesn't show the header. Is there any javascript that gets called when the mvc validation fails or when the page gets reloaded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 pageLoad 事件。
这是一篇有关文档就绪和页面加载之间差异的文章。
http://encosia.com/document-ready-and -pageload-are-not-the-same/
你还可以在局部视图中附加一个事件,这里有一篇关于添加事件的帖子:
页面加载后执行的 JavaScript
There is a pageLoad event that you can use.
Here is an article about the differences between document ready and pageLoad.
http://encosia.com/document-ready-and-pageload-are-not-the-same/
You can also attach an event in the partial view, there is a post about adding events here:
Javascript that executes after page load