国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > AJAX > 正文

Ajax傳Jsond Mvc后臺接收實例

2024-09-01 08:31:26
字體:
來源:轉載
供稿:網友
Ajax傳Jsond Mvc后臺接收,前后臺實現代碼如下,感興趣的朋友可以參考下哈,希望對大家有所幫助

復制代碼 代碼如下:


//后臺
[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) {
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平山县| 霍林郭勒市| 类乌齐县| 抚州市| 太谷县| 上蔡县| 余江县| 罗田县| 吉木萨尔县| 宣武区| 宁波市| 诸城市| 岚皋县| 青海省| 会宁县| 孝昌县| 明溪县| 特克斯县| 邛崃市| 漳州市| 察哈| 五大连池市| 云和县| 澄迈县| 耒阳市| 兰西县| 安康市| 西峡县| 呼图壁县| 淮安市| 徐汇区| 阿拉善盟| 新巴尔虎右旗| 昌图县| 阜阳市| 社会| 垫江县| 宿松县| 从江县| 大关县| 崇礼县|