Has anyone experienced problems with web applications running slow when they are called by JQuery? I will summarise the structure of my application in a sec, but in this case the application hangs in an inconsistent and unpredictable manner as if the webserver runs out of memory (but it is a dedicated webserver) or there are too many database connections or something. OK, here is the structure (I’ll tell you more afterwards):
// actionOptAdd to a submit button using jquery
//deal with data
// write to the HTML some status
// Here’s the HTML with php code where the above actionOptAdd is
associated with the clicking of a button:
_<?php print $i; ?>” class=”actionOptAdd”> <input
class=”button-click-grey” value=”Add to Project” /><span>
//And here’s the outline of php code for addToProj.php…………….
$json_array = array(…..
// do some database transactions.
// code here is not important for the problem I am describing
echo json_encode($json_array); // the .each loop in the jQuery can then analyse the output
The PHP/HTML actually binds the addtoproj (via the jQuery) to 10 or more buttons on the page (in a PHP loop, so the same code is involved but the data varies). The user can click on each button in turn to save to the database (that’s what addtoproj does), but sometimes (but far too often) the addtoproj hangs, right at the beginning of the function before having the chance to do anything, even if the previous addtoproj invocations have completed (I can see all this via firephp). Its not stuck in a loop, not busy saving anything to the database, not apparently doing anything except hanging at the very beginning of addtoproj, just after the lines necessary to enable firephp.
In the firephp console you see something like….
-GET http://www.<domain>/app/lib/addtoproj.php?<arguments here>
… and the curly thing rotating at the end of the line indicating that its waiting. Eventually it does come back.
So, actually it is the GET that hangs. Can I remind you that usually a few GETs (on clicking on the button to which the function actionOptAdd is bound) work fine, and then suddenly a GET hangs. Perhaps there are some key PHP variables I need to adjust in the PHPini file? I’ve already increased memory_limit a couple of times (currently set to -1 for no memory limit).
Sorry about the long description but I wanted to give as much detail as possible.
All help will be very much appreciated.
Help @Fusioneer spread the word by sharing this article on Twitter...Tweet This