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

140
Views
in frontend logon, ajax stays logged in but axios does not after page refresh

i'm trying to understand the difference between ajax and axios. i'm experimenting with two request methods for user login in react development using ajax and axios -- with all else being equal. when reloading the page after successful login using ajax, the user remains logged on, but when using axios, the user is no longer logged in after page refresh. is this difference expected?

loginPageAjax.js

componentDidMount() {
  $.ajax({
    method: 'GET',
    url: '/retrieveUser',
    success: (res) => {
    if (res.id) this.loginCheck(res);
    }
  });
}

loginPageAxios.js

componentDidMount() {
  axios({
    method: 'GET',
    url: '/retrieveUser'
  })
  .then(res => {
    if (res.id) this.loginCheck(res);
  })
}
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!