Topic: avoiding xajax overhead


Do I understand correctly that xajax may actually add significant overhead to the server compared to the "manual" ajax implementation. If I wish to call simple function then on "manual" ajax implementation I would directly call, but as I understand xajax calls the same URL which generated it..

If I have a webpage that has lots of SQL queries and other complex tasks and when I use xajax on that page then every request xajax sends from browser back to the server, goes to the same page. So all the unnesessary queries that appear before $xajax->processRequest(); get executed and the server resource wasted? Am I correct? I so, is there a way to avoid this problem?

Example of a program flow:

1) do 10 database queries
2) include 10 files
3) parse some regexp
4) register and process xajax query
5) do some other stuff

Then a xajax request from browser to server would repeat steps 1-4 to serve the request, correct?

Re: avoiding xajax overhead

Hello due,

While it is true that any php not part of a function is always processed when the page loads, it is not as a result of xajax.

processRequest grabs the incoming request and dispatches the requested function. The function processes and returns a response object and processRequest returns the results to the client. No further processing is done on the server.

It's not like the "normal" ajax request where all of the php code is executed every time the page is requested.

Take a look at the samples in the download and on this forum and it will become clearer.


If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.