I have an Ajax code like following
$(document).ready(function () {
var galname,URL,count,images,cur;
$.ajax({
url: "../Home/Gallery",
success: function (data) {
$(data).find("#galcontent p").each(function () {
galname=$(this).html();
URL = "../Home/Show?foldername=" + galname;
alert(URL);
$.ajax({
url: URL,
success: function (data) {
alert("find");
}
});
});
}
});
});
Actulaly i want the output like first alert URL, then goto next ajax loop and alert Find, then Next URL and so on. but in this loop its first alert all URL then goto next loop of ajax (only after the last each the second ajax loop is working.