QUOTE(rhytion @ Sep 9 2017, 10:19 AM)
Run this on any page you like, not necessary to open lazada webpage.
var getJSON = function(url) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status == 200) {
resolve(xhr.response);
} else {
reject(status);
}
};
xhr.send();
});
};
setInterval(function() {
getJSON('http://www.lazada.com.my/ajax/lottery/spinTheWheel/?lang=en&platform=desktop&wheelToken=b5dd7e9dcbde84b3e11a9ae90d377b02&dpr=2').then(function(data) {
if(data.data.voucherCode) {
console.log('Voucher: ' + data.data.voucherCode);
}
else { console.log('no voucher'); }
}, function(status) { //error detection....
alert('Something went wrong.');
}); }, 5000);
if change 5000 to lesser time, also can right?CODE
var getJSON = function(url) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status == 200) {
resolve(xhr.response);
} else {
reject(status);
}
};
xhr.send();
});
};
setInterval(function() {
getJSON('http://www.lazada.com.my/ajax/lottery/spinTheWheel/?lang=en&platform=desktop&wheelToken=b5dd7e9dcbde84b3e11a9ae90d377b02&dpr=2').then(function(data) {
if(data.data.voucherCode) {
console.log('Voucher: ' + data.data.voucherCode);
}
else { console.log('no voucher'); }
}, function(status) { //error detection....
alert('Something went wrong.');
}); }, 5000);
Sep 9 2017, 10:26 AM

Quote
0.0209sec
0.88
7 queries
GZIP Disabled