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

447
Views
Ajax: ¿Por qué el éxito muestra 0?

Uso ajax con jquery y cuando traté de mostrar el resultado en una ventana emergente. Entonces la alerta siempre muestra 0

 success : function(results) { alert(results); }

EDITAR :

 var dataToSend = { action:"ACTION_NAME", id : "12" }; url_action = 'http://www.______.com/wp-admin/admin-ajax.php'; $.ajax({ url: url_action, type:'POST', data: dataToSend, success:function(results) { alert(results); } });
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Intenta agregar die(); o exit(); en la última línea de la función.

over 4 years ago · Santiago Trujillo Report

0

Puede ser que esté intentando sin iniciar sesión. entonces necesitas usar esta acción.

add_action('wp_ajax_nopriv_my_action', 'my_action_callback');

obtendrá respuesta. :)

over 4 years ago · Santiago Trujillo Report

0

Tuve un problema similar con admin-ajax.php devolviendo 0, incluso tuve die().

Mi problema fue que add_action se declaró en un archivo que el complemento no cargó de forma predeterminada.

De todos modos, si tiene problemas, también verifique en el navegador qué devuelve __.com/wp-admin/admin-ajax.php?action=youraction.

over 4 years ago · Santiago Trujillo 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!