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

170
Vistas
How to display data from PHP using Jquery Ajax?

I'm learning how to use Ajax in Jquery and I have no idea how to display the content that I receive back from the PHP. In the php file I'm just doing some calculations and I'm echoing the result (should I return it instead?), but the code below doesn't return anything. Nothing happens the div stays empty. This is my php code:

$totaalPrice = $totaal;
$roundUp =  number_format($totaalPrice, 2, '.', '');
$replace = str_replace(".", ",", $roundUp);
echo "Uw rit kost: € " . $replace . " euro<br>";

This is how I built my Ajax:

$.ajax({
  type: "POST",
  url: "brain.php",
  data: {km:km, time:time, day:day},
  succes: function(price){
  $('#showPrice').html(price).show(price); //This where I'm trying to display the result.
  },
  error: function(){
   alert('something went wrong..');}
});
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

    $.ajax({
      type: "POST",
      url: "brain.php",
      data: {km:km, time:time, day:day},
      success: function(price){
      $('#showPrice').html(price);
      },
      error: function(){
       alert('something went wrong..');}
    });
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