Submit Ajax.BeginForm via ActionLink

心不动则不痛 提交于 2019-12-04 15:35:18

The form is hooked into Microsoft's Ajax library, so you can't just call form.submit() because the wired up ajax events aren't activated. You have a few options:

  • Use a submit button instead of a link
  • Drop the MS Ajax stuff and manually wire up your ajax posts with jQuery (this would be what I would have done)
  • Call the MS Ajax submit function

For the third option, instead of

onclick="javascript:document.forms[0].submit(); return false;"

Try

onclick="javascript:$('#form').onSubmit(); return false;"

But I've never used it so I don't know if it will work. You might also take a look here for the solution, as it sounds exactly like what you are trying to accomplish.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!