admin管理员组文章数量:1401241
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 ?
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 ?
Share Improve this question asked Nov 11, 2014 at 18:19 user3383301user3383301 1,9313 gold badges22 silver badges49 bronze badges 1-
2
Your action is a relative URL, which means it must append to the current URL. Put a forward slash before the
edit
. – Mike Commented Nov 11, 2014 at 18:22
2 Answers
Reset to default 6The 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.
Change your form action from a relative to an absolute URL, i.e.:
<form action="/edit/items" method="post" id="editform">
本文标签: javascriptForm Submit appends URLStack Overflow
版权声明:本文标题:javascript - Form Submit appends URL - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744256189a2597492.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论