I have implemented a system in which 10,000 calls are made to a PHP file which generates a random number for each call and stores it in a database table. However, I am receiving the error regarding insufficient resources. Upon evaluating the database table, it seems that 4,000 numbers have been stored successfully despite the error messages.
Below is the javascript code containing the ajax calls:
function randNoCall() {
$.ajax({
url: "randomNum.php",
method: "GET",
success: function (res) {
console.log(res);
callsMade++;
if (callsMade == 9999) {
$("p").html(" <table> <tr><th>Number Generated</th><th>Instance Name</th> </tr> " + res + "</table> <br/> <button id='evaluateButton' onClick='Evaluate()'>Evalaute</button> </br>");
}
},
});
}
var i;
var callsMade = 0;
for (i = 0; i < 10000; i++) {
randNoCall();
}
The res
variable returns the table data, meaning the numbers generated, in a table.
I have implemented a system in which 10,000 calls are made to a PHP file which generates a random number for each call and stores it in a database table. However, I am receiving the error regarding insufficient resources. Upon evaluating the database table, it seems that 4,000 numbers have been stored successfully despite the error messages.
Below is the javascript code containing the ajax calls:
function randNoCall() {
$.ajax({
url: "randomNum.php",
method: "GET",
success: function (res) {
console.log(res);
callsMade++;
if (callsMade == 9999) {
$("p").html(" <table> <tr><th>Number Generated</th><th>Instance Name</th> </tr> " + res + "</table> <br/> <button id='evaluateButton' onClick='Evaluate()'>Evalaute</button> </br>");
}
},
});
}
var i;
var callsMade = 0;
for (i = 0; i < 10000; i++) {
randNoCall();
}
The res
variable returns the table data, meaning the numbers generated, in a table.
1 Answer
Reset to default 6After researching the issue, I noted that this issue occurred due to my browser running out of resources to handle all the requests at once. To solve this, I created a button and an onClick function which made 1,000 calls, this way separating the requests, ensuring that the browser has enough resources to handle them accordingly.