Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
Getting Pop up window to login with basic authentication using Ajax?

Here I am trying to access reed.co.uk rest webapi to fetch all related jobs, When I call the URL, its showing this popup window even though I am passing username and password. This is the alert message I am getting:

http://www.reed.co.uk is requesting your username and password. WARNING: Your password will not be sent to the website you are currently visiting!

enter image description here

Pls help me where i am doing wrong.

Here is the Ajax code

var username = "xxxxx xxxxxxxxxxxxxxx";
var password = ""; 
function getAuthorizationHeader(username, password) {
var authType; 
var up = $.base64.encode(username + ":" + password);
authType = "Basic " + up;     
console.log(authType);
return authType;
};

$.ajax({
    type: "GET",
    url: "http://www.reed.co.uk/api/1.0/search?keywords=Software Engineer&locationName=London&distanceFromLocation=50",
    dataType: 'jsonp',
    async: false,
    beforeSend: function (xhr) {
        xhr.setRequestHeader('Authorization', getAuthorizationHeader(username, password));
    },        
    success: function (response) {            
        console.log(response);          
    }
});

I tried passing Authorization header like this also but still i am getting pop up window

headers: {
'Authorization': getAuthorizationHeader(username, password)
},
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It looks like it is expecting Basic Authentication. Thus you need to supply it at url.

For example:

$.ajax({
type: "GET",
url: "http://"+username+":"+password+"@www.reed.co.uk/api/1.0/search?keywords=Software Engineer&locationName=London&distanceFromLocation=50",
dataType: 'jsonp',
async: false,        
success: function (response) {            
    console.log(response);          
}});
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda