Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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..');}
});
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

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..');}
    });
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda