Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
Ajax : Why success displays 0?

I use ajax with jquery and when I tried to display the result in popup. Then alert always displays 0

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

EDIT :

 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 Respuestas
Responde la pregunta

0

Try to add die(); or exit(); at the very last line of the function.

over 4 years ago · Santiago Trujillo Denunciar

0

May be you are trying without login. so you need to use this action.

add_action('wp_ajax_nopriv_my_action', 'my_action_callback');

you will get response. :)

over 4 years ago · Santiago Trujillo Denunciar

0

I had a similar issue with admin-ajax.php returning 0, even i had die().

My problem was that the add_action was declared in a file not loaded default by plugin.

Anyway, if you have problem also check in browser what __.com/wp-admin/admin-ajax.php?action=youraction returns.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda