Im having problems using a counter with $.each I am getting a JSON feed and then want to loop out the 'title' of the results. If I use a number then it works but when I try using a counter 'ie var i = 1', it doesnt work. I think it is something to do with the variable not being passed to the function correctly?
Thanks
var i = 1;
$.getJSON("http://www.aaronlumsden.com/api/?json=get_category_posts&slug=portfolio",function(data) {
$.each(data, function(i) {
$('#navScroller').append('<li><a rel=""href="" title="">'+data.posts[i].title+'</a></li>');
i++;
});
});