asp.net mvc 2 - How to store data of complex types for use in Javascript? -
This is a reoccurring topic: either the AJAX data server can be requested and then the data is shown to the user or The page is pre-generated (i.e. sung) with the data that has some kind of interaction with javascript.
Here are some possibilities that I see how to store and manipulate (complex) data:
-
Simply store the data in the DOM and javascript Use the to-do-to-dom, do something with the data and manipulate the dom accordingly to show results. Receiving and storing data (multiple hidden areas) can be a real mistake and many selectors may be slow to get data from JavaScript. The advantage in pre-populated scenarios is that the data search engine is indexable / crawlable by spiders and pages work without javascript enabled (it is highly affected).
-
Use Javascript To keep data, use a container and DOM to visualize data only. When some action is initiated, the items obtained from DOM are something like an entity's ID, so we know what we are referring to in JavaScript. But how is the pre-populated data pushed for JavaScript? If we present them in the DOM, then we come back to the bring-to-dom scenario. We use the JSN string as the
& lt; Scripts
tags and then populate the DOM (but can it be a problem with caching?). Or we can request data to use AJX (but this causes unnecessary server loads). -
Use a prepared container, such as some jQuery table plugin (jqGrid). But it is not always possible to use a plugin because adaptation is a big requirement or component is only an overkill for your scenario.
-
In addition, do you prefer to render it as best as possible on the server (RenderPartial) and both possibly back, data with their rendered HTML / Javascript?
I have tried to search for articles about this, regardless of any direction, advice and indicators of success, are welcome.
Check out outsource data such as
Comments
Post a Comment