Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question for optimization of web applications performance

Status
Not open for further replies.

ier506

Programmer
Feb 26, 2011
7
0
0
GR
Good morning everyone. I'm new on this forum. I've started studying javascript/php/mysql by myself the last year and I need some guidance.

Here is the situation. I have designed a web application.The search panel contains 6 select elements which are dynamically generated by xhr. They are all in a "chain". E.g. when you change the first one the other 5 are dynamically generated, when you change the fifth one the sixth is dynamically generated etc...

I've achieved this functionality with JSON via PHP and I'm optimizing my code now. What I would like to know is if it's better to use one request instead of many.

Let's see an example of having three select elements:

SITUATION 1 - Multiple XHR

Continent->Country->City

In the current situation if the continent value is changed then the following will happen:

1.XHR request to countries.php
2.Response of this XHR in the Countries element.
3.XHR request to cities.php
4.Response of this XHR in the Countries element.

SITUATION 2 - Multiple XHR

In this situation if the continent value is changed then the following will happen:

1.XHR request to dropdownengine.php
2.Dropdownengine.php returns both counties and cities in JSON format.
3.JSON is proccessed and added in Country and City elements.


I am really interested to hear your thoughts on this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top