When I echo out a variable, where the variable contains data from the database
< Code = $ query = "TO_DATE (cal_date, 'YYYYMMDD'), mfg_name, cal_date by mfg_name order, cal_date, mfg_name, sales_amt, mkt_share (--- here is the subquery-) group $ data = json_encode ($ result); $ Data echo; die ();Output as a result of the following.
{"8": {"CAL_DATE": "01 -APR-2013 "," MFG_ NAME ":" AMS "," SELS_AMT ":" 1630 "," MK-4000 ":". 01 "}," 9 ": {" CAL_DATE ":" 01-AUG-2012 "," MFG_NAME ":" TEVA "," SALES_AMT_USD ":" 876 "," MKT_SHARE ":". 59 "}}
I do not know why I am receiving" 8 "" 9 "before each element data. How do I get MFG_NAME in the alert from it. Below is tried
var cdata = new array (); cdata = & lt ;? phk ek $ data ;; & gt ;; var dlen = cdata.length; var mfg_name = new For Array (); (var i = 0; i & lt; dlen; i ++) {mfg_na me [i] = cdita [i] .MFG_NAME;} alert (mfg_name);
I got a blank result in the warning. For example, in my warning above I
AMS, TEVA
How do I get parseJSON or how do I get it?Thank you in advance ...
This works for me:
cdata = '{"8": {"CAL_DATE": "01-APR-2015", "MFG_ NAME": "AMS", "SALES_AMT": "1630", "MKT_SHARE": "01"}, "9. ":" CAL_DATE ":" 01-Aug-2012 "," MFG_NAME ":" TEVA "," SALES_AMT_USD ":" 876 "," MKT_SHARE ":}} ',' 59." Cdata = JSON.parse (cdata ); Var mfg_name = new array (); var i = 0; (var key in CDAT) {mfg_name [i] = cdita [key] .MFG_NAME; i ++;} alert (mfg_name);
alert AMS, TEVA
No comments:
Post a Comment