function check() {
$.ajax({
type: 'GET',
url: '<?php echo base_url();?>index.php/info_controller/check_login',
success: function (msg) {
if (msg == 'yes') {
job = confirm('Do you want to book this time?');
if (job == true) {
alert();
}
} else {
$('.outer_table').css("opacity", 0.6).fadeIn(300, function () {
$('#login_confirm').show();
});
$('body').click(function () {
$('#login_confirm').hide();
$('body').css("opacity", 1);
});
}
}
});
return false;
}
HTML:
<a href="<?php echo base_url();?>index.php/info_controller/book/<?php echo $listinfo['days_id'];?>/<?php echo $listinfo['time_id'];?>" onclick="return check()";> <b><?php echo $listinfo['time']; ?></b></a>
This url index.php/info_controller/check_login checks whether the php session is active or not. if its active it returns msg 'yes'else 'no'.. If yes then it pops a confirm box and if i click ok it needs to return true to onclick funtion 'check' but it always returns false. ( i am using codeigniter framework by the way)