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

220
Views
AJAX/jQuery result not printing out

I'm very new to AJAX and I'm trying to use console.log data from a JSON file. I have two <input type="number"> elements and one <select> element in my HTML file, for latitude, longitude and language, and I have given the number elements default values, e.g. <input type="number" id="latitude" name="latitude" value="61.9820" min="-90" max="90" step="0.0001">. The button has an id of "btn".

$('#btn').click(function() {
    console.log('timezone is pressed');

    $.ajax({
        
        url: "timezone.php",
        type: 'POST',
        dataType: 'json',
        data: JSON.stringify({
            lat: $('#lat').val(),
            lng: $('#lng').val(),
            lang: $('#lang').val()
        }),
        success: function(result) {
            console.log(result);
        }
   });
});

The first console.log statement prints but the stringified JSON does not. I have looked at W3Schools, read the documentation and looked at an example which I'm trying to follow and I can't find where I'm going wrong

about 4 years ago · Juan Pablo Isaza
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!