MVC - Using Ajax to render partial view

◇◆丶佛笑我妖孽 提交于 2019-11-28 23:37:41

When you use this:

<a href="javascript:document.forms[0].submit()">

...you should be aware that it's not the same as

<input type="submit" />

It doesn't raise the onsubmit event, and MVC's AJAX eventhandler is not called.

To confirm this is the issue, add

<input type="submit" /> 

inside the form and try it out.

Finally, just call onsubmit() from your link

<a href="#" onclick="document.forms[0].onsubmit()">

Might be worth ensuring that you have correctly referenced the ajaxmvc and jquery scripts in your page (master page). If these are incorrect a new page will be displayed instead of the correct output in the target div.

RenderPartial takes an action name, not the name of the user control, so replace "IngredientsListControl" with "UpdateStep2", your action name.

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