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 () {
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