写法一 function () { top.location.href="logout.action"; } 写法二(在ajax中) success: function(message) { var result = $.parseJSON(message); if(result.success == 'true'){ alertMsg("更新密码成功", function(){ top.location.href = 'logout.action'; }); } }