Reputation: 7398
$.getJSON('http://example.com', function(data) {
$.each(data.songs, function(index, song) {
//Paused & waiting for a click
$("#next").click(function() {
alert("Processing the next object...");
});
});
I would that JQuery analyze the next object only after the user click on #next element.
I don't need a "timeout", just user action to go to the next object
Upvotes: 0
Views: 975
Reputation: 1381
Probably not with an each loop. You'd be better having your click function capture clicks and process an item from the list of items based on a pointer you set. So something like this:
var jsonData = "";
var pointer = 0;
$.getJSON('http://example.com', function(data) {
jsonData = data;
};
$("#next").click(function() {
//process item described by pointer
pointer = pointer + 1;
});
Upvotes: 4