var prof1 = 0, prof2 = 0,prof3 = 0, prof4 = 0,prof5 = 0, prof6 = 0,prof7 = 0, prof8 = 0,prof9 = 0, prof10 = 0,prof11 = 0, mat1 = 0,mat2 = 0, mat3 = 0, mat4 = 0,mat5 = 0, mat6 = 0, mat7 = 0,mat8 = 0, mat9 = 0, mat10 = 0,mat11 = 0;
var requestant, requestatual,prof,mat;
requestant = '';
window.setInterval(makeRequest, 10000);
httpRequest = new XMLHttpRequest();
function makeRequest() {
httpRequest.open('GET', 'result.php');
httpRequest.send();
if (httpRequest.readyState === 4) {
httpRequest.onreadystatechange = alertContents;
}
}
function alertContents() {
if (requestant !== requestatual) {
if (requestatual !== '') {
if (requestatual !== undefined) {
requestatual = httpRequest.responseText;
requestatual = requestatual.split(';');
prof = requestatual[0].split(',');
mat = requestatual[1].split(',');
prof1 = prof[0];
prof2 = prof[1];
prof3 = prof[2];
prof4 = prof[3];
prof5 = prof[4];
prof6 = prof[5];
prof7 = prof[6];
prof8 = prof[7];
prof9 = prof[8];
prof10 = prof[9];
prof11 = prof[10];
mat1 = mat[0];
mat2 = mat[1];
mat3 = mat[2];
mat4 = mat[3];
mat5 = mat[4];
mat6 = mat[5];
mat7 = mat[6];
mat8 = mat[7];
mat9 = mat[8];
mat10 = mat[9];
mat11 = mat[10];
requestant = requestatual;
grafcs();
}
}
}
}
Error
Uncaught TypeError: Cannot read property 'split' of undefined at XMLHttpRequest.alertContents
Response that result.php gives
1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , ;0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,