cutexxbaby
19 May 2011, 10:57 AM
hi
i am currently do a project
i need to use an json but i am ask to put the json format with the data into a dummy html page
how am i going to do that?
cause i need it to use later with the ajax, so i take the html url and put it in
however i need to only retrieve two attribute...so how to embedded the json in the html so that i can use it in ajax to retrieve two attribute (eg title and publisher)
["book":
{
"title":"JavaScript, the Definitive Guide",
"publisher":"O'Reilly",
"author":"David Flanagan",
"cover":"/images/cover_defguide.jpg",
"blurb":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
},
{
"title":"DOM Scripting",
"publisher":"Friends of Ed",
"author":"Jeremy Keith",
"cover":"/images/cover_domscripting.jpg",
"blurb":"Praesent et diam a ligula facilisis venenatis."
},
{
"title":"DHTML Utopia: Modern Web Design using JavaScript & DOM",
"publisher":"Sitepoint",
"author":"Stuart Langridge",
"cover":"/images/cover_utopia.jpg",
"blurb":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
}
]
i am currently do a project
i need to use an json but i am ask to put the json format with the data into a dummy html page
how am i going to do that?
cause i need it to use later with the ajax, so i take the html url and put it in
however i need to only retrieve two attribute...so how to embedded the json in the html so that i can use it in ajax to retrieve two attribute (eg title and publisher)
["book":
{
"title":"JavaScript, the Definitive Guide",
"publisher":"O'Reilly",
"author":"David Flanagan",
"cover":"/images/cover_defguide.jpg",
"blurb":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
},
{
"title":"DOM Scripting",
"publisher":"Friends of Ed",
"author":"Jeremy Keith",
"cover":"/images/cover_domscripting.jpg",
"blurb":"Praesent et diam a ligula facilisis venenatis."
},
{
"title":"DHTML Utopia: Modern Web Design using JavaScript & DOM",
"publisher":"Sitepoint",
"author":"Stuart Langridge",
"cover":"/images/cover_utopia.jpg",
"blurb":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
}
]