Window.location.href()重定向

时间:2016-06-03 06:44:34

标签: ajax cakephp

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')); ?>";
}

我正在尝试在ajax成功响应中重定向页面,它正确地重定向。但我希望页面在新窗口中打开。我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

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