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.
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.