Created
March 10, 2020 04:09
-
-
Save jiluhu/411fbc14a5afc897acb55bf259a2a1c2 to your computer and use it in GitHub Desktop.
测试跨域
This file contains 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(); | |
xhr.open('GET', 'http://localhost:8080/process-api/repository/deployments'); | |
var token= "xxxxx"; | |
xhr.setRequestHeader("x-access-token",token); | |
xhr.send(null); | |
xhr.onload = function(e) { | |
var xhr = e.target; | |
console.log(xhr.responseText); | |
} | |
//header('Access-Control-Allow-Headers:x-requested-with,content-type'); | |
//xhr.setRequestHeader("Access-Control-Allow-Origin","x-requested-with,content-type"); | |
//xhr.setRequestHeader("Content-Type","application/json;charset=UTF-8"); | |
//xhr.setRequestHeader("Access-Control-Allow-Origin","http://localhost:8080"); | |
//Content-Type:multipart/form-data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment