开发者

Redirecting to another page not working in jquery? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

I am using jquery 1.6.2 and this is my ajax call function:

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 For开发者_Python百科m');
                window.location= 'www.abc.com';
            }               
        }

This window.location is not working?

Also when in following code window.location is working in IE and FF but not in 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;
}

please help. thanks


Try with

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

Also, as Pekka noted, be sure that this is the part that's not really working. Use your JS console to check wheter the statement gets run or not.


remove the "window."

    location= "www.google.com";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜