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
jQuery AJAX no detecta el éxito

tengo el siguiente código.

 $(".likeBack").on("click", function(){ var user = $(this).attr("user"); var theLikeBack = $(this).closest(".name-area").find(".theLikeBack"); $.ajax({ type: "POST", dataType: "json", url: "processes/rewind-knock.php", data: "user="+user+"&type=likeback", success: function(json){ alert("SUCCESS"); }, error: function(jqXHR, textStatus, errorThrown){ alert("XHR: " + jqXHR + " | Text Status: " + textStatus + " | Error Thrown: " + errorThrown); } }); });

Aquí, todo es funcional. La pestaña Red muestra la solicitud y la respuesta bien recibidas según sea necesario. Sin embargo, la parte del success no se está ejecutando. Intenté agregar beforeSend y complete y ambos se ejecutan pero la parte de success (no se ejecuta nada dentro del blog de success ). No entiendo el porque.

ACTUALIZAR

Agregar parte de error. Vuelve:

 XHR: [object Object] | Text Status: parsererror | Error Thrown: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

ACTUALIZAR 2

Captura de pantalla

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

dar datos en ajax como este y comprobar,

datos: {'usuario':usuario,'tipo':'me gusta'},

En su código Php cuando devuelva los datos, coloque todos los datos en una matriz y luego use esto, echo json_encode($arr); //devuelve la matriz en forma json

ahora en su función de éxito use console.log(JSON.parse(json));

espero te pueda ayudar. Gracias

about 4 years ago · Juan Pablo Isaza Report
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!