Reputation: 1635
Trying to pull all "titles" from my json request, with no success.
Current Fiddle = http://jsfiddle.net/DZkZV/
Current Json:
{
"title": "Title 1"
},
{
"title": "Title 2"
},
{
"title": "Title 3"
},
{
"title": "Title 4"
}
Current Javascript:
var addTopTopItemsLi = function(title){
title.each(function(){
var el = new Element('li'),
htmltxt = new Element('span', {'class': 'pgTitle','html': title.title}).inject(name);
inject(gallery);
});
};
Upvotes: 1
Views: 77
Reputation: 26165
you are jumping the gun a little bit now, aren't you :)
http://jsfiddle.net/dimitar/DZkZV/1/
points: - json needed to be an array of items. - you have to pass on the whole response and then loop it. - exceptions in the .each loop and inconsistent references.
p.s. the new firebug 1.8.3 is so poor it failed to show the inner exceptions after the ajax, so frustrating...
Upvotes: 2