Page 1 of 1

jquery ajax chaining

Posted: Tue Jun 08, 2010 11:17 pm
by s.dot
How to chain jquery ajax calls to execute in a linear fashion?

My attempt:

Code: Select all

$.get(
	'script.php', { t: 2, k: 18, u: '8032' }, function() {
		alert('done1');
		$.get(
			'script.php', { t: 5, k: 18, u: '48' }, function() {
				alert('done2');
			}
		)
	}
);
No alerts, so I figure it's not executing.

Re: jquery ajax chaining

Posted: Wed Jun 09, 2010 7:15 am
by Weirdan
Works fine for me on jquery.com site:

Code: Select all

$.get("http://jquery.com", function() { console.log("1"); $.get("http://jquery.com", function () { console.log("2"); }); });
XMLHttpRequest
1
2

Re: jquery ajax chaining

Posted: Wed Jun 09, 2010 11:38 am
by kaszu
Maybe script.php returns 404?

Re: jquery ajax chaining

Posted: Wed Jun 09, 2010 2:30 pm
by pickle
Ya - use Firebug to see your requests & the results thereof.