如何在Mvc 4中添加Ajax?

编程入门 行业动态 更新时间:2024-10-19 18:20:55
本文介绍了如何在Mvc 4中添加Ajax?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨开发者, 创建一个MVC4应用程序。我曾经在aspx页面中使用更新面板和脚本amanger添加ajax。但我不知道如何在MVC剃须刀中做到这一点。任何人都可以帮我这个吗? 我的要求是: 我有一个创建用户部分,当用户点击创建,创建用户进程应该异步进行。它应该添加用户而不重新加载。 我如何做这个aspx: 脚本管理器 更新面板 -----创建用户----- 关闭更新面板

< script manager > < updtepanel> 创建用户 < / update 面板 >

我如何在MVC中执行此操作:这就是我的问题。

解决方案

您可以使用jQuery的ajax方法,或者如果您想使用ajax框架来与MVC然后你是ajax帮手 www.dotnet-stuff/tutorials/aspnet-mvc/understanding-ajax-helpers-in-asp-net-mvc [ ^ ] 要调用您的操作方法,请使用Ajax.ActionLink HTTP s://msdn.microsoft/en-us/library/dd493106(v = vs.118).aspx [ ^ ] 创建一个ajax表单使用Ajax.BeginForm msdn.microsoft/en-us/library/system.web.mvc.ajax.ajaxextensions.beginform(v = vs.118)。 aspx [ ^ ] 如果您使用谷歌,您应该找到有关如何使用这些内容的示例和教程。

Hi Developers, Am creating one MVC4 application.I used to add ajax using update panel and script amanger in aspx pages. But i dont know how to do that in MVC razor. Can anyone help me on this? My requirement is: I have one create user section when the user clicks on create, create user process should happen asynchronously.It should add the user without reloading. How do i do this aspx: script manager update panel -----Create user----- Close update panel

<script manager> <updtepanel> create user </update panel>

How do i do this in MVC : thats my question.

解决方案

You can just use jQuery's ajax method, or if you want to use the ajax framework that comes with MVC then you ues the ajax helper www.dotnet-stuff/tutorials/aspnet-mvc/understanding-ajax-helpers-in-asp-net-mvc[^] To call your action methods use Ajax.ActionLink msdn.microsoft/en-us/library/dd493106(v=vs.118).aspx[^] To create an ajax form use Ajax.BeginForm msdn.microsoft/en-us/library/system.web.mvc.ajax.ajaxextensions.beginform(v=vs.118).aspx[^] If you google you should find examples and tutorials on how to use these.

更多推荐

如何在Mvc 4中添加Ajax?

本文发布于:2023-11-24 21:02:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626809.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Mvc   Ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!