javascript - Writing AJAX to receive JSON file? -
i'm trying write ajax call using jquery's $.ajax, i'm not sure have correctly, creating html part.
i'm new @ this, i'm trying write in javascript file, create html list avatar, name, location on left hand column, , date , story in right hand column.
my json far:
var user = [ {'avatar': 'image' 'author': 'name', 'location': 'location', }, {'date': 'date', 'review': 'review'} ];
attached javascript ajax file: http://jsfiddle.net/aryx8/
i'm pretty sure of not written correctly, i'm not sure how grab json stuff , input html onto html page. have empty div container on html file far. that's it. how incorporate these 3 documents together, how write ajax function call javascript creating html in success: area?
update:
i'm trying have data in json file. retrieve data way of writing javascript/jquery ajax call, , have output "through" html file(in other words when html file ie) index.html page loaded, data json file show formatted via javascript/jquery/ajax success field.
your json appears invalid, fiddle looks might work.
try echoing more server:
var validjson = { "array": [ { "avatar": "johnny", "location": "location" }, { "avatar": "mikey", "location": "location" } ] };
Comments
Post a Comment