Guest User

Untitled

a guest
Oct 22nd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. var quizUrl = 'http://www.lipsum.com/';
  2. var myHeaders = new Headers();
  3. myHeaders.append('Content-Type', 'text/html');
  4. fetch(quizUrl,{
  5. mode: 'no-cors',
  6. method: 'get',
  7. headers: myHeaders
  8. }).then(function(response) {
  9. response.text().then(function(text) {
  10. console.log(text);
  11. })
  12. }).catch(function(err) {
  13. console.log(err)
  14. });
  15.  
  16. fetch('/url/to/get/html/file')
  17. .then((res) => {
  18. return res.text();
  19. })
  20. .then((data) => {
  21. $('#container').html(data);
  22. }
Add Comment
Please, Sign In to add comment