//后台
[httppost]
public jsonresult checkstock(ienumerable<pvidscount> pvids)
{
}
public class pvidscount
{
public int pvid { set; get; }
public int count { set; get; }
}
//前台
$(document).ready(function () {
$('#checkout').click(function ()
{
var productidcounntlist = [];
var allpvid = $(".productvariantidall");
$.each(allpvid, function (index, data) {
var productidcounnt = { pvid: data.getattribute("data-id"), count: data.getattribute("data-count")};
productidcounntlist.push(productidcounnt);
});
$.ajax({
url:"@url.action("checkstock")",
type:"post", //复杂对象传值用post,
data: json.stringify ({ pvids: productidcounntlist }), //son.stringify ---must 用来序列化
datatype: "json",
contenttype: 'application/json; charset=utf-8', //must
error: function () {
alert("1");
},
success: function (data) {
}
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
7月15日笔试总结
测验项目:3C数码商城+简答题+选择题测验时间:3小时不足之处:简答题3道题留白,完全不懂,仍需复习,一道题简写...
[阅读全文]
-
-
-
-
-
原生AJAX
AJAXAJAX 是指一种创建交互式、快速动态网页应用的网页开发技术,无需重新加载整个网页的情况下,能够更新部...
[阅读全文]
-
-
网友评论