hi
i am doing on a project i need to use the json format for the data
but i am ask to put the json in the html
after that use ajax and call into the javascript function
anyone know how can i put the json in html and how to use ajax
this is my json data
`[“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."
}
]`
Ok, so what it sounds like you want is just to be able to see What’s returned by an AJAX call without doing any logic on the page itself.
Simply doing this:
json.html:
And when you call your ajax function, the content of the page will be returned.