开发者

To Ajax or Not to Ajax a listing page

开发者 https://www.devze.com 2022-12-27 10:29 出处:网络
Here i am talking about product listing pages where there are multiple filters that filter the list of products appearing on the page like product types, categories price range etc.

Here i am talking about product listing pages where there are multiple filters that filter the list of products appearing on the page like product types, categories price range etc.

I have done such pages using both ajax and no ajax way in the past.

What I like about using ajax in such page is that, when filters are selected I only update the secti开发者_StackOverflow中文版on that contains the product list. There is no need to refresh the whole page which could end up re-loading the images on top bar, banners etc and slow down the user performance. Ajax way in my opinion becomes more compact and responsive from user experience.

Down side for ajax route for me is; since filter states are not maintained in the URL I end up maintaining them on the server. This becomes complicated if I want to handle multi window scenarios and it is also costly to maintain such state on server memory for each session.

Not using ajax and simply keeping all filter values on url and refreshing the page is quite simple but the luxury of refreshing only the pane that really needs to be refreshed is lost.

Lately I am seeing a lot of large scale e-commerce sites that are using non-ajax approach on their listing pages and this is making me question one more time if it might be more efficient to build non-ajax listing make due to the long term maintenance ease and sacrifice a little bit from user experience.

I am about to start implementing a new listing page for a product which I have the flexibility to go either way and I would appreciate your inputs.


Handling multiple tabs/windows in the AJAX case isn't really all that difficult if you just stash per-tab state in hidden form fields and pass them back with your AJAX requests, then update them from the AJAX responses. This still doesn't let users bookmark a filtered page, though.

Between not being bookmarkable, the tendency of AJAX-based navigation to break the back button, and the issue of users who may not have javascript available/enabled, I'd say to go non-AJAX, at least initially. If you really want to do this in an AJAXy manner, make it an optional enhancement to a plain HTML solution - and one that users have the option to disable even if they are in a position to use it.


To me Ajax is only good for small sections of a page. I think of it as how much data is going to be transferred with this request. If you are wanting to transfer a large listing then using Ajax loses its effectiveness as most of the page is being reloaded anyways.

If on the other hand, you are only reloading a small portion of data on a page then Ajax maximizes its effectiveness by reducing the load on the server.

I have found that going the non-Ajax route to be easiest. And you can achieve very responsive pages based on your website settings in web.config and IIS. You would want to make sure that you have page caching turned on for static pages in IIS to cut down on reloading of css, images, and js. This would allow dynamic pages to be refreshed in a faster rate and gives the illusion that only the content area of the page is reloading.

Also, enabling static content compression will help reduce initial loading of a page as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消