Last active
May 22, 2020 01:25
-
-
Save czwen/5056beffc4d8823e3f35eecfb92a2f61 to your computer and use it in GitHub Desktop.
cors_test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = new XMLHttpRequest(); | |
var token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjJkNGE1YTliLTUxNzUtNDBlNS1iZTEwLTEzMTQ3OTg1OGFmYyJ9.nY6LTeWDcPdceB6pnMFb16VIKEkYjl52IpVIzDvhVnRPCRRSXmq48wYxTL5znUpJdHP0nUNFJ4vrxHHnOajbEA'; | |
xhr.open('GET', 'http://localhost/yxt/getInfo'); | |
xhr.setRequestHeader("Authorization",'Bearer '+token); | |
xhr.send(null); | |
xhr.onload = function(e) { | |
var xhr = e.target; | |
console.log(xhr.responseText); | |
} | |
// using in console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment