Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery ajax get with authentication

var username="username_here";
var password="password_here";
$.ajax({
  type: "GET",
  url: "myapi.php",
  dataType: 'json',
  headers: {
    "Authorization": "Basic " + btoa(username + ":" + password)
  },
  success: function (result){
      console.log(result)
  }
});
 
PREVIOUS NEXT
Tagged: #jquery #ajax #authentication
ADD COMMENT
Topic
Name
9+9 =