0

How can i when click the button , the page will load the partial view and url from '/user/account/payment' to '/user/account/profile' without refresh the web page .

For me load the partial view will only using the jquery $('class').load('partial page') , but it will not change the URL .

Example website like the https://shopee.com.my/ account page .

Yang
  • 63
  • 8
  • It is not clear to me what your question is. Are you saying that `load` changes your URL or that you want it to? – Peter Smith Dec 09 '19 at 08:08
  • Hi @PeterSmith , I just wanna to load the partial view and change the URL without refresh the page . – Yang Dec 09 '19 at 08:15
  • Hi @freedomn-m, I have following this solution . But when i refresh the page will direct to the url .How can I handle the refresh problem ? Due the page is partial view .. – Yang Dec 09 '19 at 10:53
  • About the ```onbeforeunload()``` only work on close the window . – Yang Dec 09 '19 at 10:55
  • You want to change the URL, but not have it change to that url when you refresh? What exactly is the purpose here? The reason you change the url is so that you can directly back to the page the url presents, not some other random page. It is possible to use url-redirects on the server, but there seems something fundamentally wrong with what it appears you're trying to do. – freedomn-m Dec 09 '19 at 11:02

1 Answers1

0

Try this Method

$.ajax({
//some jquery ajax call properties
success: function(){
    location.hash = 'your_value';
}
})
Rahul Kr Daman
  • 387
  • 3
  • 15