The function info() appends my document with images (what is done perfectly), but I want it also to write variable next with information from json so I can use it outside of info()
var next;
var info = function(link) {
$.getJSON(link, function(json) {
$.each(json.data.children, function(i, things) {
$("#threadlist").append('<img src="' + things.data.url + '">');
});
next = json.data.after;
});
};
Welcome to callbacks