如何在mvc 4.0中为json结果调用ajax请求 [英] how to call ajax request in mvc 4.0 for json result

查看:74
本文介绍了如何在mvc 4.0中为json结果调用ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从视图到控制器调用Ajax请求以及如何从控制器获取Json结果

请以详细方式给出一个示例

How to Call Ajax Request From View To Controller And How to get Json Result from controller
please give me an example in detailed manner

推荐答案

早上好,



这里有两个例子



实施&从JQuery(MVC 4)开始使用ASP.NET WEB API [ ^ ]



http://www.kendoui.c​​om/blogs/teamblog/posts/12-05-11/hello_services_webapi_rest_json_and_ajax.aspx [<一个href =http://www.kendoui.c​​om/blogs/teamblog/posts/12-05-11/hello_services_webapi_rest_json_and_ajax.aspx\"target =_ blanktitle =New Window> ^ ]



您不会调用Controller,您将调用返回JSON的API控制器。
Good Morning,

Here's 2 examples

Implementing & Consuming ASP.NET WEB API from JQuery (MVC 4)[^]

http://www.kendoui.com/blogs/teamblog/posts/12-05-11/hello_services_webapi_rest_json_and_ajax.aspx[^]

You don't call Controller, you will call API Controller that returns JSON.


Google是您的朋友那里有很多例子。

在此处查看Web API方法示例:实施&从JQuery(MVC 4)开始使用ASP.NET WEB API [ ^ ](不太好,但从技术角度看很好),这里有一个使用旧方法:http://ricardocovo.com/2012/03/08/ asp-net-mvc-using-json-standard-responses-for-your-ajax-calls / [ ^ ]。
Google is your friend There are many examples out there.
Look here for Web API approach sample: Implementing & Consuming ASP.NET WEB API from JQuery (MVC 4)[^] (not so nice, but good from technical point of view), and here is one using the older approach: http://ricardocovo.com/2012/03/08/asp-net-mvc-using-json-standard-responses-for-your-ajax-calls/[^].


这篇关于如何在mvc 4.0中为json结果调用ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆