-1
我有一个应用程序可以将多个联系人添加到公司。联系人通过引导弹出窗口模式添加。我的客户想要一个“Save and New”按钮,在保存当前联系人后再次自动显示弹出窗口。有没有人有一个想法如何做到这一点。我已经Google搜索,但找不到任何东西。Bootstrap Multiple Modals
我有一个应用程序可以将多个联系人添加到公司。联系人通过引导弹出窗口模式添加。我的客户想要一个“Save and New”按钮,在保存当前联系人后再次自动显示弹出窗口。有没有人有一个想法如何做到这一点。我已经Google搜索,但找不到任何东西。Bootstrap Multiple Modals
有可能有几种方法来解决这个问题。了解“保存”表单现在可能会有所帮助。它是否真的提交,因此做一个回发到页面,然后将联系人数据保存到数据库?或者,你有一个ajax帖子与保存数据的按钮绑定,然后关闭模式?
我打算假设,如果用户点击“保存并新建”按钮,它会做一个帖子。因此,你的功能看起来像这样:
$("#saveAndNew").on("click", function() {
$.post("saveContact.php",
{
firstName: $("#contactFirstName").val(),
lastName: $("#contactLasttName").val(),
phoneNumber: $("#contactPhone").val()
},
function (data, status) {
if (status == "success") {
// if the post saves the data without a problem
$("#contactModal").modal("hide");
$("#contactForm")[0].reset();
$("#contactModal").modal("show");
$("#contactMessage").html("Contact saved! Ready for a new contact.");
} else {
// tell the user there was a problem with their search
$("#contactMessage").html("Unable to save contact to database.");
}
});
});
希望这会有所帮助。
通过谷歌发现,它可能有帮助:http://stackoverflow.com/questions/11868599/how-to-get-twitter-bootstrap-modals-to-stay-open-on-form-submit – trevor