2011-04-09 120 views
0

我有一个ruby-on-rails应用程序,它为初次用户显示一个模态对话框。但是,如果用户关闭对话框,我想将用户重定向到主页。我怎么做?这是我的JQuery代码片段。谢谢。JQuery模式对话框关闭事件

this.dialog(
    { 
     modal:true, 
     width:'auto', 
     height:'auto', 
     title: 'New to Purchest? Subscribe to deals that interest you!' 

     close: function(event, ui) { } 
    } 
) 
+0

类似的问题:http://stackoverflow.com/questions/503093/how-can-i-make-a重定向页面在jquery – manji 2011-04-09 01:12:51

+0

为了澄清,你在这里使用的jQuery UI对话框库,是否正确? – 2011-04-09 01:26:23

回答

4

我认为这是因为添加代码到close回调简单:

this.dialog(
{ 
    modal:true, 
    width:'auto', 
    height:'auto', 
    title: 'New to Purchest? Subscribe to deals that interest you!' 

    close: function(event, ui) { 
     top.location.href = 'http://www.wheredoyouwanttogotoday.com'; 
     // ^^ obscure microsoft marketing reference 
    } 
}); 
+0

作品非常漂亮,非常感谢。 – rookieRailer 2011-04-09 02:11:52