function onTestComplete(content) {
var url = '<%= Url.Action("JsonTest","Organization") %>';
$.post(url, null, function(data) {
alert(data["name"]);
alert(data["ee"]);
});
}
<% using (Ajax.BeginForm("JsonTest", new AjaxOptions() { HttpMethod = "POST",
OnComplete = "onTestComplete" }))
{ %>
<%= Html.TextBox("name") %><br />
<input type="submit" />
<% } %
controller:`
[HttpPost]
public ActionResult JsonTest()
{
var data = new { name = "TestName",ee="aaa" };
return Json(data);
}`
Due to some reason When I click on the button (My Break point is in the controller jsontest method) The jsontest is called twice(that's the real problem).I want to call it once as usual,using Ajax.BeginForm( "", new AjaxOptions { HttpMethod = "POST", OnComplete = "onTestComplete" })) I am able to call it once but it doesn't post the values to the controller.