asp.net jquery ajax 传json的方法如下:
后台代码:
using System;
using System.Web.Services;
namespace ajax1
{
public partial class number3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string GetJson(JsonObject persion)
{
return "{'persion':'" + persion + "'}";
}
}
}
做个比如吧:
$.ajax({
type:'get',
url:'提交到一个页面',
data:{'option':'100'},
dataType:'json',
sucess:function(data){
}
});
到那个页面应该这样获取:
string option = (Request.QueryString["option"]).ToString();
这样应该可以获取,你可以试试
这个首先要看你是post提交,还是get提交
post
在处理页面request.Form["参数名称"]
get
在处理页面request.QueryString["url后的参数名称"]