jquery ajax inside another ajax request
Here is some javascript/jquery code:
$('#button').click(function()
{
$.get("php/doit.php?id=<? echo $r['id']; ?>", function(html)
{
alert(html);
// $.get("php/doit.php?id=<? echo $r['id']; ?&g开发者_运维技巧t;", function(html)
// {
// alert('omg!');
// }
});
});
The second ajax request should be called when the first is completed, right? The above code works great, but as soon as I uncomment the second request, the whole javascript block fails - I dont even get the 'alert' anymore. Even if you put an alert just to test the .click it does not work.
Is there something that I should be clearing after ajax requests? Why exactly can I NOT make 2 requests?
Thanks
You are missing );
for the second .get
. It's just a syntax error.
精彩评论