我碰壁了,simplecart 如何 POST 数据?我尝试过接受一堆不同的数据类型,但我得到的都是空的。
用于 simplecart 设置的 JS:
<script>
simpleCart({
currency: "AUD" // set the currency to pounds sterling
});
simpleCart({
cartColumns: [
{ attr: "name" , label: "Name" } ,
{ attr: "size", label: "Size"},
{ attr: "price" , label: "Price", view: 'currency' } ,
{ view: "decrement" , label: false , text: "-" } ,
{ attr: "quantity" , label: "Qty" } ,
{ view: "increment" , label: false , text: "+" } ,
{ attr: "total" , label: "SubTotal", view: 'currency' } ,
{ view: "remove" , text: "Remove" , label: false }
]
});
simpleCart({
checkout: {
type: "SendForm",
url: "umbraco/surface/cart/cart"
}
});
</script>
我的 MVC 控制器:
// POST: cart
[HttpPost]
public ActionResult cart(string contents)
{
var test = JsonConvert.DeserializeObject(contents);
return null;
}
有谁知道如何解决这个问题,所以它实际上读入控制器?我尝试使用与购物车相同的数据制作模型,但仍然为空。