views:

327

answers:

2

update: In this case action="url.php" 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.

A: 

If your form action does not include the hash, it seems that there is some onsubmit handler which adds it again. Can you post your code?

Ralf
+1  A: 

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 -->
</form>

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

Sergio