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

344
Views
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 answers
Answer question

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 Report
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!