• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt on AJAX usage: should AJAX usage be avoided for this use case or should it be used?

 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been learning AJAX and this doubt regarding when to use and when to avoid using AJAX.


AJAX is used for refreshing a portion of page without reloading the whole page. But I see so many websites where AJAX is used in a limited way and avoided in other cases.


Example Use Case:

I have seen search websites where on entering a keyword whole page reloads to give search results. But what is the use of reloading whole page why not search results be displayed while refreshing only a portion of page.Like this there are other cases where AJAX use is avoided.I want to know why not use AJAX for these or there is a reason?

thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd have to ask the developers of the site.
 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd have to ask the developers of the site.


Actually I did not wanted to know that why they have not used but what I wanted to know was since they do not use is frequently for such use cases Is there a valid reason why AJAX should be avoided in certain cases like this.?

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, you'd have to ask them. How are we to know what factors went into their decision?

But taking a stratospheric view, I can see no reason that Ajax should be avoided for that general functionality. But again, there may be myriad factors of which we are unaware.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it is an old website? Or they are targeting certain types of users?

Can you give a link to an example of such a website? Maybe we can provide a more useful answer.
 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all.

Below is the link:


http://www.socialmention.com/
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are refreshing the page from when you enter the keyword to the full results. That is very common because most of the page needs to refresh. AJAX is meant for refreshing just part of the page. Such as autosuggesting the rest of your search string.

Google refreshed the page on search until recently as well. Now they have you type the search at the top of the page.
 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"They are refreshing the page from when you enter the keyword to the full results"

By refreshing, I assume it means that they are reloading the page at this time.


"That is very common because most of the page needs to refresh. AJAX is meant for refreshing just part of the page"

I got the point that ajax is for refreshing just part of refresh.If whole page is to be changed it is better to reload instead of refresh. However if whole page also gets refreshed using AJAX without reloading the page is it not better experience for the user?

" Such as autosuggesting the rest of your search string.".

These are common fixed uses of ajax for this there are direct ways as supported by struts etc.I want to know that usage of ajax apart from common uses as auto-suggestion or auto populating.

Thanks



 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monica. Shiralkar wrote:"They are refreshing the page from when you enter the keyword to the full results"

By refreshing, I assume it means that they are reloading the page at this time.

Yes. I meant a full page refresh.

Monica. Shiralkar wrote: "That is very common because most of the page needs to refresh. AJAX is meant for refreshing just part of the page"

I got the point that ajax is for refreshing just part of refresh.If whole page is to be changed it is better to reload instead of refresh. However if whole page also gets refreshed using AJAX without reloading the page is it not better experience for the user?

Why would it be a better experience to refresh the whole page using AJAX vs just refreshing the whole page? Gmail does implement their entire app in JavaScript, so it can be done. But for something as simple as reloading one page, I fail to see the benefit.
 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote
Why would it be a better experience to refresh the whole page using AJAX vs just refreshing the whole page? Gmail does implement their entire app in JavaScript, so it can be done. But for something as simple as reloading one page, I fail to see the benefit.


Not refreshing the whole page.I meant refreshing 90% of the page. After search results are displayed the first time, filter buttons would appear. On selecting filter buttons new results will be displayed. So the next screen would be of the same kind with two differences.First that the results would be results of filter condition not orignal search and two the screen would also have the filter buttons.

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not all about the visible content. There is a huge difference between "the whole page" and 90% of the visible content. Even 99% of the visual content. Remember, refreshing the whole page also loses any context and starts everything completely from scratch.

So in the case you are talking about, where the majority of the page is results, and only a small portion is form controls that define the result filters, I'd still use Ajax so as not to have restore the context from scratch on each change.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic