如何在codeigniter
中进行服务器端表单验证后打开模型弹出窗口//调用模态弹出窗口
<a data-toggle="modal" data-target="#register">REGISTER </a>
//这是我的模态弹出窗口
<div id="register" class="modal fade">
<form method="POST" action="">
<div class="modal-dialog">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"></button>
</div>
<div class="modal-body">
<input type="text" placeholder="Name" name="name">
<span class="red"><?php echo form_error('name'); ?></span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close
</button>
<button type="submit" name="sub_customer" value="save" class="btn btn-primary">
Save
</button>
</div>
</div>
</form>
</div>
答案 0 :(得分:0)
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="add_register_popup"></div>
<a onclick="ajax_register_popup();">REGISTER </a>
function ajax_register_popup ()
{
$.ajax
({
url: "<?php echo "your url of your register view page "?>/",
success: function (data)
{
$('#add_register_popup').html(data);
$('#add_register_popup').modal({
backdrop: 'static',
keyboard: false
});
}
});
}
尝试这样,首先制作函数并像我一样在弹出div中绑定该视图,然后使onclick触发该函数并使用主模式div为你的弹出视图调用并通过#add_register_popup id绑定。尝试一下,确定它可以帮助你。