Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setrequestheader authorization bearer

var params = 'name=intro_home&status=true';
var xhttp = new XMLHttpRequest();
xhttp.open("POST", process.env.API_URL + 'intro/save', true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.setRequestHeader('Authorization', localStorage.getItem('auth._token.laravelJWT'));
xhttp.onreadystatechange = function () {//Call a function when the state changes.
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      alert('ok');
    }
  }
xhttp.send(params);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setrequestheader #authorization #bearer
ADD COMMENT
Topic
Name
4+7 =