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

183
Views
La solicitud de obtención de Ajax permanece en estado listo 1, pero cuando registro el texto de respuesta en la consola, lo muestra sin problemas

No puedo mostrar el resultado en mi html porque la solicitud permanece en el estado 1 y el texto de respuesta se muestra indefinido. Cuando accedo a la url, muestra el valor que quiero mostrar en mi html. ¿Por qué está pasando esto? Estoy usando django en el lado del servidor por cierto. Un poco nuevo en ajax pero no he podido encontrar una respuesta a este problema en otras preguntas ya resueltas.

Código que ejecuta la solicitud:

 const getHighScore = (gameID, levelID) => { let ajaxPrueba = $.ajax({ url: `/get-data/${gameID}/${levelID}`, type: 'get', success: function(data) { return data; }, failure: function(data) { console.log('Got an error dude'); } }); return ajaxPrueba; }

Los parámetros que paso son 1 para gameID y 1 para levelID La URL de la que estoy hablando

También esto es lo que devuelve la consola:

 ajaxPrueba = $.ajax({ url: `/get-data/1/1`, type: 'get', success: function(data) { return data;… Object { readyState: 1, getResponseHeader: getResponseHeader(e), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(e, t), overrideMimeType: overrideMimeType(e), statusCode: statusCode(e), abort: abort(e), state: state(), always: always(), catch: catch(e) , … }​ abort: function abort(e)​ always: function always()​ catch: function catch(e)​ done: function add()​ fail: function add()​ getAllResponseHeaders: function getAllResponseHeaders()​ getResponseHeader: function getResponseHeader(e)​ overrideMimeType: function overrideMimeType(e)​ pipe: function pipe()​ progress: function add()​ promise: function promise(e)​ readyState: 4​ responseText: "22"​ setRequestHeader: function setRequestHeader(e, t)​ state: function state()​ status: 200​ statusCode: function statusCode(e)​ statusText: "OK"​ then: function then(t, n, r)​ <prototype>: Object { … } ajaxPrueba.readyState 4
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!