开发者

$.ajax equalivant for $.load content filter

开发者 https://www.devze.com 2023-02-05 23:25 出处:网络
jQuery lets me filter content when using $.ajax()\'s shorthand $.load() like following: $(\'#foo\').load(\'/path/to/foo.html #navigation li\');

jQuery lets me filter content when using $.ajax()'s shorthand $.load() like following:

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

How do implement this same functionality using $.ajax(); ?

开发者_如何学C
$.ajax({
    url : 'nextpage.php',
    /* get me some specific elements */
})


Something like this should do what you want:

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

精彩评论

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