通过MVC3中的jQuery的HttpGet和HttpPost [英] HttpGet and HttpPost through jquery In MVC3

查看:86
本文介绍了通过MVC3中的jQuery的HttpGet和HttpPost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想使用jquery使用HttpGet和HttpPost方法创建MVC应用程序. 请帮助我

谢谢与问候,
Soumya

Hi,

I would like to create an MVC application with HttpGet and HttpPost methods using jquery
Pls help me

Thanks & Regards,
Soumya

推荐答案

使用类似以下内容的方法:

Use something like:


.ajax({ type: "POST", url: url, contentType: ''application/json; charset=utf-8'', data: postData, dataType: "json", success: function (result) { if (redirectOnError("json", result)) { return; } SuccessFunction(result); }, error: errorHandler
.ajax({ type: "POST", url: url, contentType: ''application/json; charset=utf-8'', data: postData, dataType: "json", success: function (result) { if (redirectOnError("json", result)) { return; } SuccessFunction(result); }, error: errorHandler



URL可以是"http://baseurl/controller/action"的形式.因此,请确保同时定义了两者.

对于获取"请求,只需更改
类型:"GET"
另外,您还必须传递附加在查询字符串中的参数.



URL s''d be the form of "http://baseurl/controller/action". So make sure you have both defined.

For ''Get'' request just change
type: "GET"
And also you have to pass parameters attached in query string.


这篇关于通过MVC3中的jQuery的HttpGet和HttpPost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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