var post = 10;
function load_more(str) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("add").innerHTML = document.getElementById("add").innerHTML + xmlhttp.responseText;
}
};
var post = post + 10;
xmlhttp.open("GET", "fetch_more.php?number=" + post , true);
xmlhttp.send();
}
When I load the website, I expect the browser to determine the value 10 for publication and do nothing until I press the button that calls the load_more () function, which increments this value by 10 and passes it to PHP via Ajax.
The desired behavior is to have 10 posts on the site, and then click 10 clicks on the button each time the button is clicked.
But PHP just throws a MySQL error, and the log shows that post var is NaN.
source
share