0

I have the following code which works but dosent perform as expected:

$(".switch_org").click(function(e){

    var id = $(this).attr('id');        
    var orgID = id.split("_");

    e.preventDefault();

    $.cookie('current_organisation', orgID[1], { expires: 1, path: '/' });
    window.location.replace("index.php");

});

The cookie is set which works fine but the page is not redirected to index.php it just reloads the same page. Am I doing something wrong? Is there an additional step I can add so that it does redirect to index.php?

Thanks

Elliot
  • 257
  • 7
  • 15

1 Answers1

0

Don't use window.location.replace, directly assign the value to

window.location

or

windows.location.href
Aditya Singh
  • 9,512
  • 5
  • 32
  • 55
  • I did try those, I tried them again, still just reloads the same page with the new cookie set. – Elliot Feb 15 '13 at 09:13