TAGS :Viewed: 13 - Published at: a few seconds ago

[ How to store XML file on client's system and access it through JavaScript ]

The problem is- I have a manage reservation page where I have table images of my restaurant. when I drag drop a particular reservation on a table, that table gets assigned to that reservation. When I click on tables image I show the table info in a popup. Now here comes the problem, to fetch table info page goes back to server(postback) and LINQ the collection and populate the info.This reduces the performance.What I want to do is to serialize tableInfo collection and save that XML in client's system and rather than postbacking the page I can fetch the table details from that XML through javascript. Is this possible?can I store that XML in clients machine?

OR what else I can do to increase performance??

Answer 1

It depends.

One way would be to use Web Storage (either localStorage or sessionStorage), but that requires a browser that supports it (very few do).

If you only need the data in the context of a single page (or don't have a problem with requesting it once per page), then you can simply keep it in some global variable (for example as a property of the window object).

Answer 2

There are a couple of options with this. First, you could continue to make the server side call but utilize jQuery/AJAX/loading images to make the wait less painful.

The other option would be to use HTML 5 local storage. Stephen Walther has a good example project of how to use it.