asp.net - jQuery submit form on linkClick event -



asp.net - jQuery submit form on linkClick event -

form @using (html.beginform(new { id="form"})) { //fields} link

<div align="center" id="submitlink">@html.actionlink("next", "address", "pes", new { abc= "xyz" }, null)</div>

script

$(function () { $("#submitlink").click(function () { $("#form").submit(); }); });

form not submitting when click next linkwhat doing wrong??

try set id on link instead of div:

<div align="center"> @html.actionlink("next", "address", "pes", new { abc= "xyz" }, new { id="submitlink" }) </div>

you should consider setting action , if needed controller form:

@using (html.beginform("actionname","controller",formmethod.post, new { id="form"})) { }

the overload of beginform you're using set routevalues id="form".

jquery asp.net asp.net-mvc asp.net-mvc-3

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -