I am using an ajax call and getting a response as an HTML.
I want to retrieve only the body part from the response HTML and append it to the body section.
I trying the below ajax call:
$("#formID").on("submit", function (event) {
event.preventDefault();
var url = $(this).attr("action");
var formData = $(this).serialize();
$.ajax({
url: url,
type: 'POST',
data: formData,
async: true
}).done(function(response, status){
$('body').html(jQuery(response).find('body').html());
}).fail(function(jqXHR, stat, error) {
console.log(stat + ": " + error);
});
});
HTML where I want to append the retrieved HTML.
<body>
<div id="wrapper">
//Content
</div>
</body>
My main motive is to exclude the script part from the received HTML as the scripts are loading again and freezing the custom css spinner/loader.
The freezing of the custom css spinner/loader is happening only when I am connecting it to the server in Safari, in chrome(local & server) it is working fine.
Please help me to resolve this.
Thanks in advance.