Reputation: 847
I have:
$.ajax({ type: 'POST',
url: myLink,
async: false,
dataType: 'html',
success : function(page) {
var fragment = page.find('#myId').html();
...
// I'll append my fragment to #somewhere
});
this is not working, console says page.find is not a function
.
what am I doing wrong?
Upvotes: 0
Views: 310
Reputation: 62392
Try this...
var fragment = $(page).find('#myId').html();
page
itself is just a string containing the html you requested... So you have to first create a jQuery object to call jQuery methods on.
Upvotes: 3