I don't know how to put the value of this.responseText into index_no, it's like the function into the onreadystatechange event it's creating its own variable called inde_no, 'cause if I do an alert out of the function it print undefined
let index_no;
function segnalibro(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
index_no=parseInt(this.responseText);
}
}
xmlhttp.open("GET", "Segnalibro.php?ISBN="+ISBN, true);
xmlhttp.send();
}
segnalibro();