Search
 
SCRIPT & CODE EXAMPLE
 

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)
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: execute bash program using js 
Javascript :: selected angular select 
Javascript :: cordova android close app with back button 
Javascript :: remove id attribute javascript 
Javascript :: js browser tab inactive check 
Javascript :: wordpress not loading jquery 
Javascript :: isotope cdn 
Javascript :: difference between var and let 
Javascript :: forjs check if key in json 
Javascript :: react bootstrap carousel caption placement top 
Javascript :: how to get text from input js 
Javascript :: covid-19 
Javascript :: electron hide devtools 
Javascript :: remove classname to node 
Javascript :: how to get element by id in node js 
Javascript :: settimeout function javascript for loop 
Javascript :: javascript toisostring without milliseconds 
Javascript :: javascript convert object to querystring 
Javascript :: insertadjacenthtml javascript 
Javascript :: suspense react 
Javascript :: react native header 
Javascript :: divisible by 3 javascript 
Javascript :: js click anchor 
Javascript :: axios default baseurl conditional environment 
Javascript :: concat js mdn 
Javascript :: error An unexpected error occurred: "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.11.2.tgz: ESOCKETTIMEDOUT". 
Javascript :: suppress spaces in front and in the end of a string javascript 
Javascript :: install javascript kali linux 
Javascript :: how to get folder names with fs 
Javascript :: make text lowercase javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =