我尋找這個到處都是,但沒有得到答案this.I編碼我PHP數組後有一個JSON對象,如:閱讀JSON對象
{
"6":{"brand_id":"6","brand_logo":"http:\/\/images.cdn.bigcartel.com\/bigcartel\/account_images\/457974\/max_h-1000+max_w-1000\/tn.jpg","brand_discovered_count":"2","brand_name":"Not Human Clothing","brand_template_id":"3","products":[{"product_id":"9","product_price":"19.99","product_images":"http:\/\/images.cdn.bigcartel.com\/bigcartel\/product_images\/131442291\/-\/blackpom2.jpg"}]},
"7":{"brand_id":"7","brand_logo":"http:\/\/images.cdn.bigcartel.com\/bigcartel\/account_images\/465045\/max_h-1000+max_w-1000\/frontttt.jpeg","brand_discovered_count":"3","brand_name":"Trill LOVE","brand_template_id":"2","products":[{"product_id":"11","product_price":"49.99","product_images":"http:\/\/images.cdn.bigcartel.com\/bigcartel\/product_images\/134025228\/-\/l3.jpeg"}]}
}
我怎麼能在阿賈克斯
讀這在javascript$.ajax({
type:'POST',
dataType: 'json',
data: 'var1=' + var1,
url:'myurl',
success:function(response){
alert(response);
},
error:function(e){
alert('Error:' +e);
}
});
[如何解析JavaScript中的JSON]的可能重複(http://stackoverflow.com/questions/4935632/how-to-parse-json-in-javascript) –