am having the data sa
var data = '[{"idcoupons_tbl":"1","discount_percent":"10"}]';
when i try to parse and get a discount_percent
ie
var result= jQuery.parseJSON(data);
alert(result["discount_percent"]);
FIDDLE it returns Undifined, thanks in advance
your variable result
is an array, currently with 1 item, doing
result[0]["discount_percent"]
should work
var data = '[{"idcoupons_tbl":"1","discount_percent":"10"}]';
var result = jQuery.parseJSON(data);
alert(result[0].discount_percent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.