I want to create a string representation of certain html forms for storing in the hash portion of the url.
I was lazily hoping that there would be such a method and jquery. serialize() seems to do the trick, except that in all the examples I've seen, it uses the 'this' object of a form submission. On my site the forms aren't getting submitted, I just want to be able to serialize them. I've tried:
params['formParams'] = $("#"+currentSearchForm).serialize();
but I just get an empty string instead of the serialized form.
Should I spoof a form submission and generate my serialized string in it, and then cancel the default event or something? Seems a little contrived..?
Alternatively could be I'm just doing serialize wrong..
Thanks for your help!