Debiprasad Debiprasad - 1 year ago 71
Javascript Question

I don't want url #hash to be in the url after submitting the form

update: In this case

works as I desired

When I submit a form (I use get method), the url #hash part also got appended to the end of url after submit of the form. I tried to change the action of the page to get rid of this url #hash from the string. I removed the action part from the form, provided action as action="url.php", provided action as action="url.php#", but nothing helped me to get rid of the URL #hash after submitting the form. Is there any way to get rid of this url #hash after submitting the form?

I use jQuery.

Answer Source

Not sure I know what you mean, but you could try using a POST action rather than GET. This will shift form data out of the URL.

<form action="test.php" method="post">
<!--stuff in here -->

another thought, if you are submitting the form via jQuery and using the click handler of an anchor tag, try making sure you 'return false', or try using a submit button and catching $("#myForm").submit() instead

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download