亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Ajax傳Jsond Mvc后臺接收實(shí)例

 更新時(shí)間:2013年06月09日 16:07:08   作者:  
Ajax傳Jsond Mvc后臺接收,前后臺實(shí)現(xiàn)代碼如下,感興趣的朋友可以參考下哈,希望對大家有所幫助
復(fù)制代碼 代碼如下:

//后臺
[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", //復(fù)雜對象傳值用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) {
}

相關(guān)文章

最新評論