2011-01-20 88 views
0

的jQuery让我过滤内容使用的$.ajax()速记$.load()时像以下:

$('#foo').load('/path/to/foo.html #navigation li'); 

如何实现使用$阿贾克斯()这个相同的功能; ?

$.ajax({ 
    url : 'nextpage.php', 
    /* get me some specific elements */ 
}) 

回答

3

像这样的东西应该做你想要什么:

$.ajax({ 
    url : 'nextpage.php', 
    // … 
    success: function(result) { 
     $('#foo').html($(result).find('#navigation li').get(0)); 
    } 
})