重定向到另一个不在jquery中工作的页面?

时间:2011-10-13 07:53:01

标签: php jquery ajax

我正在使用jquery 1.6.2这是我的ajax调用函数:

function remoteCall(sUrl, sQueryStr)
{     
    $.ajax({
        type:    "POST",
        url:     sUrl,
        data:    sQueryStr,
        async:   false,
        success: function(response){
            var obj = $.parseJSON(response);
            if( obj.status === "N" ){
                alert('You have already submitted the Form');   
                window.location= 'www.example.com';
            }
            if( obj.status === "S" || obj.status === "Y"){
                alert('Thank you for sumbitting the Form');
                window.location= 'www.abc.com';
            }               
        }

window.location无效?

此外,在以下代码window.location正在使用IE和FF但不在Chrome中

function remoteCall1(sUrl, sQueryStr,div)
 {
     $.post(sUrl,  sQueryStr ,
         function(response){
          if(div !=''){
             $('#'+div).html(unescape(response));
             return true;
             }else{
             window.location= "www.google.com";
             }
         });
 }

    }); 
    // return URL_Redirect;
}

请帮忙。 感谢

2 个答案:

答案 0 :(得分:2)

尝试

 window.location.href = "http://www.google.com";

另外,正如Pekka所指出的那样,请确保这是不起作用的部分。使用您的JS控制台检查语句是否运行。

答案 1 :(得分:0)

删除“窗口”。

    location= "www.google.com";