I designed a form (using Ajax.BeginForm
method) for POST and GET dual purposes. Default HTTP method is GET
. I am
@using (Ajax.BeginForm("action", "Home",
null,
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "updateArea",
HttpMethod = "Get",
}){
/* Form fields,*/
<input id="Add" type="button" value="Add" />
<input id="Search" type="submit" value="Search" />
}
How do I validate the form only when the form is posting (for instance $.post
or $.ajax({type:'POST'})
)?