php - How do I access the properties of objects that are placed a javascript object? -
i have php file sends json string of objects javascript file. having problems accessing properties of objects contained within javascript object.
my php file:
for($i=0; $i<$hitcount; $i++){ if($i == $hitcount-1){ // if hitcount less 25 results echo json_encode($articlearray); exit(); }else if($i == 25){ // there max of 25 results per request echo json_encode($articlearray); exit(); }else{ $page = $xml -> request -> page ; //always page 1 $title = $xml ->resultlist -> result[$i] -> title; if($title == false){ $title = ''; } $pmid = $xml ->resultlist -> result[$i] -> pmid; if($pmid == false){ $pmid = ''; } $authorstring = $xml ->resultlist -> result[$i] -> authorstring; if($authorstring == false){ $authorstring =''; } $journaltitle = $xml ->resultlist -> result[$i] -> journaltitle ; if($journaltitle ==false){ $journaltitle = ''; } $pubyear = $xml ->resultlist -> result[$i] -> pubyear; if($pubyear == false){ $pubyear = ''; } $journalvolume = $xml ->resultlist -> result[$i] -> journalvolume; if($journalvolume == false){ $journalvolume = ''; } $issue = $xml ->resultlist -> result[v] -> issue; if($issue == false){ $issue = ''; } $pageinfo = $xml ->resultlist -> result[$i] -> pageinfo; if($pageinfo == false){ $pageinfo = ''; } $articlearray[] = array( 'hitcount' => $hitcount, 'page' => $page, 'pmid' => $pmid, 'title' => $title, 'authors' => $authorstring, 'journaltitle' => $journaltitle, 'pubyear' => $pubyear, 'journalvolume' => $journalvolume, 'issue' => $issue, 'pageinfo' => $pageinfo ); } } my javascript file:
// retrieve json string var json_obj = json.parse(xmlhttp.responsetext); i have tried following access properties of objects stored in javascript object:
json_obj[0].title // access title of first object this returns:
[object object] xmlhttp.responsetext:
[{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25745995"},"title":{"0":"hypoxia upregulates rab11-family interacting protein 4 through hif-1\u03b1 promote metastasis of hepatocellular carcinoma."},"authors":{"0":"hu f, deng x, yang x, jin h, gu d, lv x, wang c, zhang y, huo x, shen q, luo q, zhao f, ge t, zhao f, chu w, shu h, yao m, fan j, qin w."},"journaltitle":{"0":"oncogene"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800835"},"title":{"0":"kinetic activation of rab8 guanine nucleotide exchange factor rabin8 rab11."},"authors":{"0":"feng s, wu b, per\u00e4nen j, guo w."},"journaltitle":{"0":"methods mol biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"1298"},"issue":"","pageinfo":{"0":"99-106"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26032412"},"title":{"0":"structure-function analyses of interactions between rab11 , rab14 small gtpases shared effector rab coupling protein (rcp)."},"authors":{"0":"lall p, lindsay a, hanscom s, kecman t, taglauer es, mcveigh um, franklin e, mccaffrey mw, khan ar."},"journaltitle":{"0":"j biol chem"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25815277"},"title":{"0":"rab11 in disease progression."},"authors":{"0":"bhuin t, roy jk."},"journaltitle":{"0":"int j mol cell med"},"pubyear":{"0":"2015"},"journalvolume":{"0":"4"},"issue":"","pageinfo":{"0":"1-8"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800843"},"title":{"0":"in vitro , in vivo characterization of rab11-gap activity of drosophila evi5."},"authors":{"0":"laflamme c, emery g."},"journaltitle":{"0":"methods mol biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"1298"},"issue":"","pageinfo":{"0":"187-194"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"24917558"},"title":{"0":"vasodilator-stimulated phosphoprotein promotes activation of hepatic stellate cells regulating rab11-dependent plasma membrane targeting of transforming growth factor beta receptors."},"authors":{"0":"tu k, li j, verma vk, liu c, billadeau dd, lamprecht g, xiang x, guo l, dhanasekaran r, roberts lr, shah vh, kang n."},"journaltitle":{"0":"hepatology"},"pubyear":{"0":"2015"},"journalvolume":{"0":"61"},"issue":"","pageinfo":{"0":"361-374"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25480917"},"title":{"0":"vangl2 cooperates rab11 , myosin v regulate apical constriction during vertebrate gastrulation."},"authors":{"0":"ossipova o, chuykin i, chu cw, sokol sy."},"journaltitle":{"0":"development"},"pubyear":{"0":"2015"},"journalvolume":{"0":"142"},"issue":"","pageinfo":{"0":"99-107"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25831508"},"title":{"0":"trappii regulates exocytic golgi exit mediating nucleotide exchange on ypt31 ortholog raberab11."},"authors":{"0":"pinar m, arst hn jr, pantazopoulou a, tagua vg, de los r\u00edos v, rodr\u00edguez-salarichs j, d\u00edaz jf, pe\u00f1alva ma."},"journaltitle":{"0":"proc natl acad sci u s a"},"pubyear":{"0":"2015"},"journalvolume":{"0":"112"},"issue":"","pageinfo":{"0":"4346-4351"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25305083"},"title":{"0":"rab11 modulates \u03b1-synuclein-mediated defects in synaptic transmission , behaviour."},"authors":{"0":"breda c, nugent ml, estranero jg, kyriacou cp, outeiro tf, steinert jr, giorgini f."},"journaltitle":{"0":"hum mol genet"},"pubyear":{"0":"2015"},"journalvolume":{"0":"24"},"issue":"","pageinfo":{"0":"1077-1091"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25862161"},"title":{"0":"a novel role of rab11 in trafficking gpi-anchored trans-sialidase plasma membrane of trypanosoma cruzi."},"authors":{"0":"niyogi s, docampo r."},"journaltitle":{"0":"small gtpases"},"pubyear":{"0":"2015"},"journalvolume":{"0":"6"},"issue":"","pageinfo":{"0":"8-10"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25673879"},"title":{"0":"the arf , rab11 effector fip3 acts synergistically asap1 direct rabin8 in ciliary receptor targeting."},"authors":{"0":"wang j, deretic d."},"journaltitle":{"0":"j cell sci"},"pubyear":{"0":"2015"},"journalvolume":{"0":"128"},"issue":"","pageinfo":{"0":"1375-1385"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25972173"},"title":{"0":"synaptic function of rab11fip5: selective requirement hippocampal long-term depression."},"authors":{"0":"bacaj t, ahmad m, jurado s, malenka rc, s\u00fcdhof tc."},"journaltitle":{"0":"j neurosci"},"pubyear":{"0":"2015"},"journalvolume":{"0":"35"},"issue":"","pageinfo":{"0":"7460-7474"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25632160"},"title":{"0":"myosin va mediates bdnf-induced postendocytic recycling of full-length trkb , translocation dendritic spines."},"authors":{"0":"sui wh, huang sh, wang j, chen q, liu t, chen zy."},"journaltitle":{"0":"j cell sci"},"pubyear":{"0":"2015"},"journalvolume":{"0":"128"},"issue":"","pageinfo":{"0":"1108-1122"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25686250"},"title":{"0":"early steps in primary cilium assembly require ehd1\/ehd3-dependent ciliary vesicle formation."},"authors":{"0":"lu q, insinna c, ott c, stauffer j, pintado pa, rahajeng j, baxa u, walia v, cuenca a, hwang ys, daar io, lopes s, lippincott-schwartz j, jackson pk, caplan s, westlake cj."},"journaltitle":{"0":"nat cell biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"17"},"issue":"","pageinfo":{"0":"228-240"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25904794"},"title":{"0":"protein interacting c-kinase 1 deficiency impairs glutathione synthesis , increases oxidative stress via reduction of surface excitatory amino acid carrier 1."},"authors":{"0":"wang yn, zhou l, li yh, wang z, li yc, zhang yw, wang y, liu g, shen y."},"journaltitle":{"0":"j neurosci"},"pubyear":{"0":"2015"},"journalvolume":{"0":"35"},"issue":"","pageinfo":{"0":"6429-6443"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26041286"},"title":{"0":"intracellular transport of vaccinia virus in hela cells requires wash-vpef\/fam21-retromer complexes , recycling molecules rab11 , rab22."},"authors":{"0":"hsiao jc, chu lw, lo yt, lee sp, chen tj, huang cy, ping yh, chang w."},"journaltitle":{"0":"j virol"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25704914"},"title":{"0":"mechanisms regulating cell membrane localization of chemokine receptor cxcr4 in human hepatocarcinoma cells."},"authors":{"0":"cepeda eb, dediulia t, fernando j, bertran e, egea g, navarro e, fabregat i."},"journaltitle":{"0":"biochim biophys acta"},"pubyear":{"0":"2015"},"journalvolume":{"0":"1853"},"issue":"","pageinfo":{"0":"1205-1218"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26021297"},"title":{"0":"the small gtpase rab29 common regulator of immune synapse assembly , ciliogenesis."},"authors":{"0":"onnis a, finetti f, patrussi l, gottardo m, cassioli c, span\u00f2 s, baldari ct."},"journaltitle":{"0":"cell death differ"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26004511"},"title":{"0":"slitrk5 mediates bdnf-dependent trkb receptor trafficking , signaling."},"authors":{"0":"song m, giza j, proenca cc, jing d, elliott m, dincheva i, shmelkov sv, kim j, schreiner r, huang sh, castr\u00e9n e, prekeris r, hempstead bl, chao mv, dictenberg jb, rafii s, chen zy, rodriguez-boulan e, lee fs."},"journaltitle":{"0":"dev cell"},"pubyear":{"0":"2015"},"journalvolume":{"0":"33"},"issue":"","pageinfo":{"0":"690-702"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25753037"},"title":{"0":"ltp-triggered cholesterol redistribution activates cdc42 , drives ampa receptor synaptic delivery."},"authors":{"0":"brachet a, norwood s, brouwers jf, palomer e, helms jb, dotti cg, esteban ja."},"journaltitle":{"0":"j cell biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"208"},"issue":"","pageinfo":{"0":"791-806"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26110570"},"title":{"0":"predominant rab-gtpase amplicons contributing oral squamous cell carcinoma progression metastasis."},"authors":{"0":"da silva sd, marchi fa, xu b, bijian k, alobaid f, mlynarek a, rogatto sr, hier m, kowalski lp, alaoui-jamali ma."},"journaltitle":{"0":"oncotarget"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26067165"},"title":{"0":"site-specific phosphorylation of vegfr2 mediated receptor trafficking: insights computational model."},"authors":{"0":"clegg lw, mac gabhann f."},"journaltitle":{"0":"plos comput biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"11"},"issue":"","pageinfo":{"0":"e1004158"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25941134"},"title":{"0":"mechanisms of apical-basal axis orientation , epithelial lumen positioning."},"authors":{"0":"overeem aw, bryant dm, van ijzendoorn sc."},"journaltitle":{"0":"trends cell biol"},"pubyear":{"0":"2015"},"journalvolume":"","issue":"","pageinfo":""},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25394938"},"title":{"0":"the fungal pathogen cryptococcus neoformans manipulates macrophage phagosome maturation."},"authors":{"0":"smith lm, dixon ef, may rc."},"journaltitle":{"0":"cell microbiol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"17"},"issue":"","pageinfo":{"0":"702-713"}},{"hitcount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800842"},"title":{"0":"3d time-lapse analysis of rab11\/fip5 complex: spatiotemporal dynamics during apical lumen formation."},"authors":{"0":"mangan a, prekeris r."},"journaltitle":{"0":"methods mol biol"},"pubyear":{"0":"2015"},"journalvolume":{"0":"1298"},"issue":"","pageinfo":{"0":"181-186"}}]
it's because title object.
"title":{ "0":"hypoxia upregulates rab11-family interacting protein 4 through hif-1\u03b1 promote metastasis of hepatocellular carcinoma." } if can't change output try access this:
json_obj[0].title["0"]; but better if title comes php ready use. don't see reason return array in case.
Comments
Post a Comment