So I'm trying to extract an array with title attributes like so:
function pullContent() {
var dir = './assets/slides/';
var titles = [];
$.ajax({
url: dir,
success: function (data) {
$(data).find("li a").each(function () {
var filename = $(this).attr('title');
titles.push(filename);
});
}
});
return titles;
}
This is meant to pull the title attributes using ajax, push them into a array and then return the array.
The problem is that I don't know how to access said array because it returns without a name, like this: http://i64.tinypic.com/2hhhkq0.png
So my question is really just, how do I access an array like this?
I'm trying to catch it in another function and pull titles[0/1/2] but it doesn't work.