Reputation: 1911
i want to submit an form using Jquery.But my form Url appends with existing URL and submitting the form with the appended URL.
Before Submit :
URL on Browser : localhost:8000/view/items
HTML:
<form action="edit/items" method="post" id="editform">
<input type="hidden" id="itemID" value="blahblah">
<a href="#" id="editItem">Edit</a>
</form>
JQuery:
$("#editProperty").click(function(e){
$("#editPropertyForm").submit();
});
After Form Submit I get i.e URL goes as : localhost:8000/view/items/edit/items
How do i solve it ?
Upvotes: 1
Views: 2173
Reputation: 1341
The problem is that your form's action is a relative path. I think what you want is "/edit/items"
. That'll take the root path and add edit/items to it.
Upvotes: 6
Reputation: 1696
Change your form action from a relative to an absolute URL, i.e.:
<form action="/edit/items" method="post" id="editform">
Upvotes: 5