Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Created June 5, 2011 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/1008839 to your computer and use it in GitHub Desktop.
Save hkulekci/1008839 to your computer and use it in GitHub Desktop.
JQuery Recursively Ajax
function recursively_ajax(active_num,end_num){
var number = 0;
if (active_num == end_num) return;
$.ajax({
type:"GET",
url: "pages.php",
data: "p="+active_num,
success: function(data){
$('.printable_area').addClass("done");
$('.printable_area').append(data);
number += data.find('p').length;
$('.printable_area').tsort("p[class]",{orderby:"class"});
number += recursively_ajax(active_num+1,end_num);
}
});
return number;
}
// i use normally "async: false" settings.
// success settings not work now to get async.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment