Javascript and web application data

I am pretty new to Web Application programming and so to OOP Javascript and the new Client-Server interactions.
I am encountering some trouble wondering about how much AJAX I should use or how much data I have to save “locally” .
Explainig it better: at the moment , to manage the data that I obtain from AJAX request , I push them in Data Structure like Array’s and then I handle them helping myself rendering html through template.
Now, was I wondering : is all this necessary? Do I really need to store all this data in Data Structures or I can make AJAX call for every action users do on my application?
I apologize for the explanation but it’s a difficult concept for me to explain in English.
Thanks in advance

0

It is not cut and dry but it should be a simple rule of thumb. If the page “needs” the data then embed it in the page. Needs would mean that no matter what action the user does the data is needed to perform that action.

For example the page is a grid that has a list of orders, the order data is needed to populate the grid which is the only item on the screen. It would make sense to embed the data. Now if the user clicks a row and a popup appears with more data that should probably be done with an ajax request cause the user may or may not see the popup.

The only situation where I wouldn’t embed the page when it is need would be if the data takes a very long time to generate. No user would tolerate a url request that takes 5+ seconds to come back. A quick response and a loading mask would be more acceptable.

The correct answer is: “It depends”.

See it all depends on your need what actually you want. If the requirement of data is huge then it is better to make just one ajax call and store the data in client side and can do further processing. This will slow cut down the extra time which will may be required in huge ajax requests. But in case you require small chunks of data, then making separate ajax requests for each data has no harm.

It’s enough to make it feel like that the data is always present, you just have to figure out how to show or process so it will feasible with user point of view.

Going out to separate pages for simple small pieces data is much MUCH slower than referencing it locally. On the other hand, storing too much locally can start causing major issues as well.

If all you want to do is store a few user specific variables, then do it locally. If you want to access and parse entire data dumps with hundreds of rows with tens of columns, do that server-side with AJAX.

It’s all about balance. Think of it this way:

I store all my pens at my desk in a cup. I just use them to write and take notes, I have black, blue, red, and a pencil. This works well anything more would just be a hassle.

But say I was a professional artist who needed hundreds or thousands of different pens and pencils of different types, storing all of this on my desk in cups would be a mess and inefficient. I would need to store them in boxes something where I could easily move around and find what I needed, even if I used them constantly this method would still be much more efficient than if I was to just put them all in cups on my desk.

Hope that makes sense.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật