开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜