如何从以下JSON中获取product_price
值?
success: function(response){
if (response.data.product_id == true) {
alert("Success");
alert(response.data.product_price.val());
{
"data": {
"product_id": true,
"product_price": "434",
"product_name": "yahoo",
"product_long_description": "asdfasdf",
"product_care": "yess",
"product_image": "\/easyinteriors\/public_html\/product_images\/144257317733697.jpg"
}
}
alert(response.data.product_price);
我得到空值
答案 0 :(得分:0)
使用这段代码:
alert(response.data.product_price);
答案 1 :(得分:0)
如果要将数据返回到json格式。您需要解析响应
var json = $.parseJSON(response);
然后alert(json.data.product_price);