Skip to content

Instantly share code, notes, and snippets.

@Kolenov
Created January 16, 2018 10:31
Show Gist options
  • Save Kolenov/84159ee89e152560fa5a1d226361b814 to your computer and use it in GitHub Desktop.
Save Kolenov/84159ee89e152560fa5a1d226361b814 to your computer and use it in GitHub Desktop.

XMLHttpRequest

var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://example.com/', true);
xhr.withCredentials = true;
xhr.send();
fetch('https://example.com', {
  credentials: 'include'  
})

JQuery

$.ajax({
   url: 'https://example.com',
   xhrFields: {
      withCredentials: true
   }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment