Hi all,
I want to know how to process a page by using AJAX?
I have a table with 10MB size of data…
I have a form, in that i used 4 select boxes.
First one is populated on column1 of distinct values…
based on selection of first, second will be populate by fetching column2 data based on column1(selected in first select box), like that upto 4 select boxes are there…
For this i used AJAX.
Now my question is;
Is the data of size 10MB will fetch at the time of loading the AJAX page, and based on selection it will populate on client side…?
(or)
Every time the query will go to server and populate the items for each select boxes…?
What do you mean exactly when you say you have 10 MB of data? Sending 10MB of data to the client’s browser is unacceptable. 10 MB large HTML file might event crash the browser. However, if you have 10MB of data in your database, and send only a small portion of it to the client, there should be no problem.
right now, there is only 200 rows in the database…
If it increased to a maximum of 5000 rows, at that time is there any problem arises, to populate the data, for select boxes?
Right now, first select box is populating based on the first column…
based on the selection of first select box, second will be populate by querying the first column… and so on…
In future, any problem are there, if i use like this. In the point of bandwidth or in the point of more users at a time?
If you query the database each time the user does a selection, and send only the data needed for the following dropdown, there should be no problems with bandwidth.
I don’t know how many users you are expecting, but I don’t think there should be a problem with too many simultaneous database connections.
Say you want to populate the second <select> combo box according to the value chosen in the first combo box. You could then make a javascript function that will pass the value that the user selected in the first combo box to a php script on the server, and use the server response to show the second combo box to the user. Server’s response could contain the complete html code for the second combo box, so you just use javascript to place that code in some div where you would like the combo box to show up. When you have such a function, you can simply bind it to the first <select>'s onchange event, and voila.