Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "names" : {/*stuff needed for names goes in here*/},
- "dates" : {/*stuff needed for dates goes in here*/},
- "fuzzyThings" : {/*all fuzzy things goes in here*/}
- }
- function handler(retText) {
- var returnedObject = eval(retText);
- doStuffWithNames(returnedObject.names);
- doStuffWithDates(returnedObject.dates);
- playWithFuzzyThings(returnedObject.fuzzyThings);
- }
- <?php
- echo '{';
- echo '"names":{';
- include 'names.php';
- echo '},';
- echo '"dates":{';
- include 'dates.php';
- echo '},';
- echo '"fuzzyThings":{';
- include 'fuzzyThings.php';
- echo '}';
- echo '}';
- ?>
- "user" : [ {
- "name" : "Harry",
- "hobby" : "Skating"
- }, {
- "name" : "Dave",
- "hobby" : "Scuba Diving"
- } ],
- "news" : [ {
- "date" : "3/13/05",
- "title" : "Blah",
- "postedby" : "Mike",
- } ]
- var data = eval('('+ xhr.responseText +')'); // Ajax response
- var user = data.user[0].name; // Harry
- var user2 = data.user[1].name; // Dave
- var title = data.news[0].title;
Add Comment
Please, Sign In to add comment