Manipulating data from an ajax call before putting results in div

时间:2015-07-31 19:31:36

标签: jquery ajax

I'm calling a page and my returned results is the data of that page (duh). Here's what it looks like:

$.get('/myPage.html',function(data){

$('#results').html(data);

});

What I need to do is remove an element from that returned data. After I do that, I need to extract just the contents of the <body>. Once that's complete, I want to put the results into a variable. The only way I know of to do this is have a container, #results, and send the data there. Once my data is there, then I could remove/extract. Is there a way for me to do this without first putting it into the #results?

1 个答案:

答案 0 :(得分:1)

we can use $(data).find('.some-selector').remove()