CanaryNoir
6/4/2014 - 5:29 PM

jquery redirect

jquery redirect

//Get current url:

path = $(location).attr('href');

//Redirect Using jQuery

var url = "http://jquery4u.com";    
$(location).attr('href',url);

$(function() {
  path = $(location).attr('href');
  console.log(path);
  if (path.indexOf("1811") != -1) {
    $(location).attr('href','/annual'); // change url 
    // OR
    window.location.assign("//aacuweb.org/events"); // instantly redirect to new page
  }
});