문제

'I have a page where after an AJAX and js function runs I need to reload the page and go to a specific JqueryUI tab. (in this case the tab is 'tabs-b') (jquery-ui-1.8.20)

This code reloads the page, but does not go to the tabs-b (its at the default)

var formID = 'tabs-b';
window.location.href=$('survey1.php','#'+formID).val();
window.location.reload(true);

I have also tried this to the same effect:

window.location.href='survey1.php#tabs-b';
window.location.reload(true);

however when I just type it into the browser it works. I am stumped. I am fairly new to js so it may be a noob syntax error, but I have not found any other people with the same issue.

도움이 되었습니까?

해결책

In you code you do not need window.location.href and window.location.reload. reload (true) will fetch from the server the current page based upon the existing url.

Just use window.location.href

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top