
jQuery.deserialize ()
We had to do the operation inverse to jQuery.serialize () method, i.e. fill in the form on the GET line. I didn’t seem to find anything, I thought that writing would be faster than digging around. I’m handing out what happened to everyone who wishes, maybe someone will save an hour or two.
Take here:
github.com/maxatwork/jquery.deserialize
UPD: Thank you all for the bug reports!
UPD: Comrade nayjest tells you what applications are needed.
I needed to navigate the ajax search results:
- the form is serialized, the result is written to window.location.hash
- when the page loads, the data from location.hash is deserialized, and the form is sent to the server.
Then the search remains without reloading the page, but as before, you can copy the link to the result, and send it to a friend, for example.
In the case of jQuery Form Plugin, it looks something like this:
Take here:
github.com/maxatwork/jquery.deserialize
UPD: Thank you all for the bug reports!
UPD: Comrade nayjest tells you what applications are needed.
I needed to navigate the ajax search results:
- the form is serialized, the result is written to window.location.hash
- when the page loads, the data from location.hash is deserialized, and the form is sent to the server.
Then the search remains without reloading the page, but as before, you can copy the link to the result, and send it to a friend, for example.
In the case of jQuery Form Plugin, it looks something like this:
$(document).ready() {
$("#searchForm")
.ajaxForm( myFormCallback )
.deserialize(window.location.hash)
.submit()
.change( function () {
window.location.hash = $(this).formSerialize();
$(this).submit();
});
function myFormCallback(response) {
//do smth
}
}