开发者

jquery ajax problems

Can anyone help me with the following code? The second ajax call is never been reached. What am i doing wro开发者_StackOverflowng?

      $('a').click(function(){
      var url1 = $(this).attr('href');
        $.ajax({
            url: url1,
            sucess: function(data){
                var content = $('div[title="categorii"]', data).html();
                alert ("success1");
                $('a',content).click(function(){
                    alert ("ajax2");
                   var url2 = $(this).attr('href');
                   $.ajax({
                       url: url2,
                       success: function(data1){
                           var content2 = $('div[title="categorii"]', data1).html();
                           $('div[title="categorii"]').html(content2);
                       }
                    });
                    return false;
                });
                $('div[title]').html(content);
            }
        });
        return false;
    });


What do you mean it isn't reached? All the code does is add an event handler that will call ajax when clicked. It will not call your second ajax method without being clicked.

Call the click() method if you want to fire the event handler attached with click(handler)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜