I want to replace the contents inside div with id = test with the modified AJAX response
javascript:
('.test').bind('ajax:success', function()
{
$.ajax({
success: function(html){
$('.test').text($(html).find("#test")); // returns [object Object]
}
});
});
But $(html).find("#test") returns an [object Object] and $(html).find("#test").html() returns null
How can I get the contents of div with id “test” in the ajax response?
Based on this blog link, the answer is in the second parameter:
Then, your code would be: