如何在mvc4中显示消息框 [英] how to display message box in mvc4

查看:72
本文介绍了如何在mvc4中显示消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..,

如何在保存数据之前显示确认消息,并在保存按钮单击中保存数据后显示信息消息。

解决方案

您需要使用javascript ConfirmBox [ ^ ]用于保存之前的确认和 AlertBox [ ^ ]来显示通知保存后。



--- Amit


在视图中



 <  输入   类型  = 按钮    value   =  ClickMe    onclick   =  callFunction();    /  >  

< script 类型 = text / javascript >
函数callFunction(){
//这里你可以执行验证操作
//这里你可以使用Alert或jquery对话框显示确认消息

.ajax({
url://保存动作url
类型://
数据:


成功:函数(数据){
//这里
//保存数据后你也可以通过使用Alert或jquery对话框显示确认消息
},
错误:function(e){
debugger;
}
});
}
< / script >


Hi..,
How to Show Confirmation message before saving data and also show information message after saving data within a save button click .

解决方案

You need to use javascript ConfirmBox[^] for confirmation before saving and AlertBox[^] to show the notification after saving.

---Amit


In View

<input type="button" value="ClickMe" onclick="callFunction();" />

<script type="text/javascript">
    function callFunction() {
        //here u can perform Validation Operations
        //here u can show Confirmation message by using Alert or jquery dialog


.ajax({ url:// save action url type:// data: . . success: function(data){ //here //after saving data u can also show Confirmation message by using Alert or jquery dialog }, error: function(e){ debugger; } }); } </script>


这篇关于如何在mvc4中显示消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆