I am using CakePHP 2.3.6 & Bootstarp in a project. In the menu bar, there is a menu that I want when clicked, if the user is logged in, send an Ajax request and return a successful message, else load the login page in the modal plugin and let the user login. The login page can be on the same page, there is no need to use modal plugin to call a remote page.
Here is the pseudocode :
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
I am using Bootstrap's modal plugin in another page :
<?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>
So, is there any way to do it ?
Please help me.
Thanks