2016-06-09 74 views
0

从上ForgotPassword链接我的登录页面,用户点击并进入该页面填写了一个表格,并要求一个新的密码如何在ASP.NET MVC中创建一个简单的引导模式对话框

http://localhost:2350/Account/ForgotPassword 

现在当他们在该页面中点击保存时,他们的请求已创建。 所以我需要的仅仅是一个引导模态对话框弹出“您的请求已提交”和它“确定”按钮,当他们点击OK需要他们回到登录页面。

我从来没有做过Ajax,弹出对话框等。像这样。你能指点我一些教程代码,不太复杂,不能遵循和重现吗?因为我的模式非常简单,不包含任何数据,只有一个静态文本和一个OK按钮,可以重定向到登录页面。

+0

您使用的引导程序版本是什么? – Ram

回答

5

你可以设置你的Bootstrap Modal这样的:

<div class="container"> 

    <h3>Modal Example</h3> 

    <!-- Button to trigger modal --> 
    <div> 
    <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch Modal</a> 
    </div> 

    <!-- Modal --> 
    <div id="myModal" class="modal hide" tabindex="-1" role="dialog"> 
    <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
     <h3>Modal Example</h3> 
    </div> 
    <div class="modal-body"> 

     <p> 
     This is your body 
     </p> 

    </div> 
    <div class="modal-footer"> 
     <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
     <button id="submitButton" class="btn btn-primary">OK</button> 
    </div> 
    </div> 

</div> 

而在你的JavaScript代码,你赶上click事件OK按钮。然后,调用ajax并重定向到登录页面。

$('#submitButton').click(function() { 

    // Call AJAX here 
    $.ajax({ 
    method: "POST", 
    url: "", // Your URL here 
    data: "" // Your data here 
    }); 

    // Redirect here 
}); 

有关更多详细信息,请检查此jsfiddle

2

我推荐bootbox.js(http://bootboxjs.com/)。

这是一个很好的自举小插件,它可以实现一些非常简单但很朴实的引导式风格模式行为,并提供您所需要的。

该文档也很不错。

相关问题