Advertisement
STANAANDREY

getHtmlFromFile

Sep 9th, 2020 (edited)
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2. async function getHtmlFromFile(f) {
  3.  var fbody;
  4.  fbody = await fetch(f).then(function(response) {
  5.     return response.text();
  6.   }).then(function(body) {
  7.     return body;
  8.   }).catch(function(error) {
  9.     console.error(error);
  10.   });
  11.   return fbody;
  12. }
  13.  
  14. $(document).ready(async () => {
  15.   var f = './content.html';
  16.   var r = await getHtmlFromFile(f);////*/
  17.   alert(r);
  18.   //$('#con').html(r);
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement