2016-08-18 71 views
0

是否有可能重定向searchusers.html與此編碼?mainView.router.loadPage不工作在Ajax成功

myApp.onPageInit('home', function (page) { 
$$.ajax({ 
    type: 'GET', 
    url: "http://localhost/some.php?name="+window.localStorage.getItem('key'), 
    cache : false, 
    async: false, 
    dataType: "JSON", 
    success:function(data){ 
     if (data == "nooneinfollowinglist") { 
      mainView.router.loadPage('searchusers.html'); 
     } 
    } 
}); 

回答

1

我知道這是不可能的重定向這種方式。僅使用事件,我們可以像這樣重定向頁面:

myApp.alert('nobody',function(){ 
    mainView.router.loadPage('searchusers.html'); 
});