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

349
Vistas
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 Respuestas
Responde la pregunta

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