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

86
Vistas
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

over 4 years ago · Santiago Trujillo
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