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

346
Visualizações
Variable in JavaScript, why putting `var` does not work?

When I put var in front of method and url (var method, and var url) the code does not work.

function intervalcheck(theObject) {
  var xmlhttp = new XMLHttpRequest(),
    method = 'POST',
    url = 'https://thekmui.com/payb/payresult/result.php';

  xmlhttp.open(method, url, true);
  xmlhttp.onload = function () {
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Take a look at here:

var xmlhttp = new XMLHttpRequest(),
    method = 'POST',

You are putting ','(comma) after each line. Either you leave it empty and browser handle the rest. Or you can put ';' semi-colon like this:

 var xmlhttp = new XMLHttpRequest();
    method = 'POST';

Otherwise the code will produce a massive error. You may follow this post as well: Send POST data using XMLHttpRequest

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