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

82
Visualizações
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 à 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