0
var recivedData;
var obj, dbParam, xmlhttp;
obj = { "table":"customers", "limit":100 };
dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
recivedData=this.responseText;
}
};
xmlhttp.onreadystatechange
document.getElementById("demais").innerHTML = recivedData;
xmlhttp.open("GET", "reg.php", true); xmlhttp.send(); console.log(recivedData); var datasource=recivedData;
At this time she is returning Undefined
– Luis Carlos
You are trying to access the value before it is available. You need to understand how asynchronous operations work.
– bfavaretto