Jump to content

ajax based or PHP based


jimfog
 Share

Recommended Posts

I am building a web app where the user has the option of storing favorites business users where each one of them offers some services.

 

These services must be seen but the user...whenever he/she clicks on one of the favorites business user.

 

Here is the question:

What do you think it is better....prefetch the services with PHP, hide them and make them visible when the user "asks" for them or

bring them with ajax the moment the user "asks" them.

 

P.S when I say asks them...I mean a user action such as clicking a button...

Link to comment
Share on other sites

I think the best solution is to have a PHP pagination system which is overridden by AJAX.

 

That means that at no point do you download all the data at once which is a cause of slow page loading.

Link to comment
Share on other sites

I think the best solution is to have a PHP pagination system which is overridden by AJAX.

 

That means that at no point do you download all the data at once which is a cause of slow page loading.

I do not think pagination will be needed here since 2-5 services(for now) must be shown to the user....not much data.

So...assuming no pagination, you suggest that I download the data with PHP after all?

 

And hide it of course till the user "asks" them of course...

Link to comment
Share on other sites

If the amount of data is small enough that downloading all of it does not cause a noticeable reduction in load time, then I would just download it all. 99.9% of the time AJAX methods are fast enough to result in no serious lag, however the other .1% can result from the user having a poor connect, the load on the server is at a stress level, the user is running something else which can slow down javascript, or the user has a heavy download going on in background.

Link to comment
Share on other sites

If the amount of data is small enough that downloading it all does not cause a noticeable reduction in load time, that probably means it fits on one page of paginated data. If you don't like to see pagination buttons on your page, you can program it not to display the buttons if there's only one page.

Link to comment
Share on other sites

If the amount of data is small enough that downloading it all does not cause a noticeable reduction in load time, that probably means it fits on one page of paginated data. If you don't like to see pagination buttons on your page, you can program it not to display the buttons if there's only one page.

Exactly....the data is small enough so as to justify such a decision-to download all the data.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...