Answers for "javascript fetch html text"

0

javascript fetch html text

// Javascript Fetch for HTML/TEXT
fetch('/about').then(function (response) {
	// The API call was successful!
	return response.text();
}).then(function (html) {
	// This is the HTML from our response as a text string
	console.log(html);
   // Show result on screen using jQuery
	jQuery(function(){
         jQuery('.resultLayer').show().html(html);
    })
}).catch(function (err) {
	// There was an error
	console.warn('Something went wrong.', err);
});
Posted by: Guest on October-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language