How to save AJAX application state using jQuery

I'm just trying to plunge into this Ajax thing. I have a very simple question.

I saw the UI plugin ( http://interface.eyecon.ro/docs/drag ) for jQuery, where you can drag frames, stretch things, animate, etc. Thus, basically you get all the desktop features right in your web application.

In the desktop world, you can save the state of objects in a file, but how to save the state of managed objects in jQuery.

For example, if I dragged a frame in jQuery or stretched the borders of a div element, how can I save it to a file on the server, so the next time I open it will be changed?

+4
source share
2 answers

Collect the state into an object, serialize it in JSON , do an HTTP POST using AJAX on a script on your server that saves it accordingly.

Download it using the reverse method (you can skip AJAX and print JSON directly on your page while it loads)

+6
source

Yes Nilesh - height () and width () . I do not know my own method that provides positional data, although there may be a plugin; otherwise, some raw javascript should be enough for some raw javascript to be enough.

+1
source

Source: https://habr.com/ru/post/1277773/


All Articles