开发者

jquery - ajaxForm plugin and only using part of the response

开发者 https://www.devze.com 2023-01-29 18:08 出处:网络
I know with jquery and ajax, you can specify what for example, an id of the element to get back (so you don\'t have to parse the whole document yourself).

I know with jquery and ajax, you can specify what for example, an id of the element to get back (so you don't have to parse the whole document yourself).

I'm wondering where to do this in the ajaxForm plugin, or if I have to do that myself.

For the simplest example I can think of, here's this:

$(#myForm).ajaxForm({
    success: function(responseText){
        alert(responseText);
    }
});

What if rather than alerting the whole result (which is an entire page), I'd like to alert only what's in a certain element of the result (say, <div id="result"></di开发者_StackOverflow社区v>)

Best way to accomplish this?


alert($(responseText).find('#result'));
0

精彩评论

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