2

I have a script whose structure is like below :

$(location).attr('href','<?php echo $this->here; ?>'+'#qualification');

Though I was expecting to redirect to myurl#qualification it does not redirect at all. If I remove the #qualification, it redirects successfully to desired location. How can I redirect ( or refresh the page) to url myurl#qualification

Nitish
  • 2,695
  • 9
  • 53
  • 88

3 Answers3

0

Try removing the '+' :

$(location).attr('href','<?php echo $this->here; ?>#qualification');
presidentnickson
  • 1,075
  • 8
  • 17
0

Try it without jQuery like this:

window.location.href = '<?php echo $this->here; ?>#qualification';
Ex-iT
  • 1,479
  • 2
  • 12
  • 20
0

Try this one

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";

window.location = "http://stackoverflow.com";

Read more about it here How to redirect to another webpage in JavaScript/jQuery?

Community
  • 1
  • 1
user1954544
  • 1,619
  • 5
  • 26
  • 53