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

170
Views
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 answers
Answer question

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 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!