jquery ajax get 数组参数
2020-12-13 04:28
标签:json 一个 code get size 参数 设置 span type 对一些get请求,但方法参数要求是数组或集合的,如下 参数ids是一个集合,请求方式 http://www.XX.com/test?ids=1&ids=2 上面写法ids的值会收到1和2 如果以ajax的get方式请求,除了直接拼url外,还可以这样写 设置 traditional:true即可 这样就不用拼url了 jquery ajax get 数组参数 标签:json 一个 code get size 参数 设置 span type 原文地址:https://www.cnblogs.com/evemen/p/11110546.html public virtual ActionResult Test(Listint> ids)
{
return Json("");
}
var ids = new Array();
ids.push(1);
ids.push(2);
$.ajax({
type: "get",
traditional:true,
url: "/test",
data: { ids: ids },
dataType: "json",
success: function (res) {
}
});