Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!