0
我在項目中使用CakePHP 2.3.6 & Bootstarp。在菜單欄中,有一個我想要點擊的菜單,如果用戶登錄,發送Ajax請求並返回成功的消息,否則加載模式插件中的登錄頁面並讓用戶登錄。登錄頁面可以在同一頁面上,不需要使用模態插件來調用遠程頁面。當用戶在CakePHP 2.x中登錄時使用Bootstrap的Modal插件
這裏是僞代碼:
If(the user is logged in)
send an Ajax request to a page and show return message
else
show the login page in the modal window
我使用引導的模式插件在另一頁:
<?php echo $this->Html->link($user['User']['name'],array('controller'=>'users','action'=>'view',$user['User']['id']),array('data-toggle'=>'modal','data-target'=>'.modal'));?>
.
.
.
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
</div>
.
.
.
<script>
$('.modal').on('hide.bs.modal',function(){
$(this).removeData('bs.modal');
});
</script>
那麼,有沒有辦法做到這一點?
請幫幫我。
感謝
看起來像完美。好的,我會試試這個。 @ZakariaWahabi – 2014-10-27 04:25:20