estado de los elementos de la interfaz de usuario de jquery en JSON

How can I store the state of draggables and droppables from jquery UI into JSON? I want to save the state and retrieve them back using JSON. Is this the best way or alternate ways are also possible?

preguntado el 30 de enero de 12 a las 19:01

No, I am a newbie and trying to know how to accomplish. -

2 Respuestas

Use the callbackhandlers of the draggable/Droppable events to get the values which have changed.

You could save those values using localStorage/sessionStorage, so you don't need to save the data to the server.

There is also an polyfill for the Storage API you can use for IE.

Intente algo como esto:

$( ".yourdraggable_element" ).draggable({
   stop: function(event, ui) {

you now can retrieve the position:


Note: this is only a starting point! E.g. you first have to check if localStorage, so please dont take this as complete solution!

Respondido el 31 de enero de 12 a las 00:01

Can you please give me an example of how it is implemented so that I can see and follow? I don't know where to start for now. - Un mil usos

I would recommend jQuery UI -, which supports drag-and-drop through the Draggable and Droppable interactions. They have extensive documentation when it comes to JSON callbacks etc.

Respondido el 30 de enero de 12 a las 23:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.