Reputation: 6183
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.
Upvotes: 2
Views: 2685
Reputation: 1
You can use exact url with: $_SERVER[HTTP_HOST]
and $_SERVER[REQUEST_URI]
variables.
Sample usage:
<form action="http://<?=$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]?>" method="post">
Upvotes: 0
Reputation: 9927
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
Upvotes: 1
Reputation: 11042
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?
Upvotes: 0