javascript - Parsing json from external url Html and JS only -
<html> <body> <div id="output">hi</div> </body> <script> var link="http://mywp.com/cilacap/api/get_posts/"; var jcontent= json.parse(link); var output=document.getelementbyid('output'); output.innerhtml=jcontent.id' '; </script> </html>
it shows "hi". can tell me how show json items such "id" , "postdate" looping without php scripting?
thanks
few syntactical errors, below right one.
<html> <body> <div id="output">hi</div> </body> <script> var link='{"url":"http://mywp.com/cilacap/api/get_posts/", "id":"url_id_01"}'; var jcontent= json.parse(link); var output=document.getelementbyid('output'); output.innerhtml=jcontent.id + ' '; </script> </html>
json data(var link)
, not parsable.
json data(var link)
, didnt contained attribute called id
.
string concatenation in last line(output.innerhtml
), wrong.
Comments
Post a Comment