0

I am trying to basically refresh the page upon form submission, but INCLUDING a hash '#'.

For example, the url is: www.example.com/segment#foo

Using:

$("#form-name").submit(function(){
 location.reload();
});

does not include the hash.

Any help many thanks.

user1226560
  • 39
  • 1
  • 4

2 Answers2

0

Have you tried just adding the fragment (#foo) in the url in the action attr of the form ?

<form method="POST" action="http://example.com/segment#foo" ...>
Allende
  • 1,480
  • 2
  • 22
  • 39
0

The fragment won't be sent to the server (Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?) so you will have to encode that data some other way.

Community
  • 1
  • 1
Douglas
  • 36,802
  • 9
  • 76
  • 89