Harshal Borse Harshal Borse - 6 months ago 24
Ajax Question

Window.location.href() redirection

Ajax redirection in success response

success: function(json) {
if(json.status == "success")
{
window.location.href = "<?php echo $this->Html->url(array('controller' => 'Dashboard', 'action' => 'index')); ?>";
}


I am trying to redirect the page in ajax success response, It is redirecting properly. but I want the page to be open on new window. How can i do that ?

Answer
window.open(
 '<?php echo $this->Html->url(array('controller' => 'Dashboard', 'action' => 'index')); ?>',
 '_blank' // <- This is what makes it open in a new window.
);