I'm trying to extract the body
tag from .ajax()
but I get undefined
logged to console...
This is my code:
$(document).ready(function(){
var user;
$(".subacc_info").on('click', '#submit_user_delete', function(){
user = $(this).closest($(".subacc_info")).find($("#subacc_name")).text();
$.ajax({
type: "POST",
url: '/user/profile/delete',
data: {user: user},
dataType: "html",
success: function(data){
$result = $(data).find('body').html();
console.log($result);
}
});
});
Am I doing something wrong?
console.log(data)
prints this string to console:
'<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
<div class="container">
....
</div> <!-- /container -->
</body>
</html>'