Jump to content
jimfog

ajax based or PHP based

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

Share this post


Link to post
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.

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

I would ask if there's a compelling reason to load all data at once. Is the user likely to look at all of the data? If not, then why load it all?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

One more thing to consider is AJAX won't work if a user has JavaScript disabled. If you do decide to use AJAX, you need to have a good fallback in place.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...