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

119
Vistas
HTTP API CALLS Issue when using application/x-www-form-urlencoded and header

I am trying to send a api call from my javascript with contentType: "application/x-www-form-urlencoded", But the call also requires we to include the session-token to be included in the header and when I do both of them together it gives me error. How to send both of header and content type together?

Request:

function g_ajaxerV2Receive(url_str, ok_cb, fail_cb){
    $.ajax({
        url: url_str,
        type: "POST",
        crossDomain: true,
        data: "",
        success: ok_cb,
        error: fail_cb,
        timeout: 60000,
        dataType: "json",
        contentType: "application/x-www-form-urlencoded",
        headers: {
            "Session-Token:" + String(SessionToken), //Token is in variable
        }
    });
}

The error that I get when both contentType and Header exist:

Access to XMLHttpRequest at 'https://API-URL' from origin 'http://127.0.0.1:5505' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

And the requirement for the call is that we need both The session token and the application/x-www-form-urlencoded.

The allowed CURL requestExample:

curl 'https://URL-HERE'
  -H 'Session-Token: session_token_here'
about 4 years ago · Juan Pablo Isaza
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