i have a php page on my server that controls my mysql database. there is also another page that displays everything. i downloaded that page into my pc and modified the code for it to be still able to connect to that php file on my server that controls the database.
when the html page is on the server it works fine. but, when i downloaded it it does not work anymore. here is some of the code: btw, all functions are written in javascript.
function queryNumberOfQuestions() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var numberOfQuestions = parseInt(this.responseText);
populateSequence(questionOrder, numberOfQuestions);
shuffle(questionOrder);
}
};
xhttp.open("GET", "http://wael-alghamdi.com/getQuestionCount.php", true);
xhttp.send();
}
function queryNextQuestion(questionNumber) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
theQuestion = this.responseText.split(',');
updateGame();
}
};
var url = "http://wael-alghamdi.com/getQuestion.php?row=" + questionNumber.toString();
xhttp.open("GET", url, true);
xhttp.send();
}
function queryOtherAnswers(questionNumber) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
otherAnswers = this.responseText.split(',');
updateGame();
}
};
var url = "http://wael-alghamdi.com/getOtherAnswers.php?row=" + questionNumber.toString();
xhttp.open("GET", url, true);
xhttp.send();
}
what i changed was those three lines:
xhttp.open("GET", "http://wael-alghamdi.com/getQuestionCount.php", true);
var url = "http://wael-alghamdi.com/getQuestion.php?row=" + questionNumber.toString();
var url = "http://wael-alghamdi.com/getOtherAnswers.php?row=" + questionNumber.toString();
so my question is how can i make it work even if the php is on a different machine?