aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Getting JQuery's serialize and load function to play together. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Getting JQuery Watch "Getting JQuery New topic
Author

Getting JQuery's serialize and load function to play together.

Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It seems that JQuery's serialize function returns a www-form-encoded string but the load function expects a JavaScript object.

Is there a way to either get the serialize function to return an object (like with Prototype's serialize object) or to let the load function know that its being passed a string instead of an object (like with the 4th argument in JQuery's post method)?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61056
    
  66

I believe that you are looking for serializeArray() which will return a construct acceptable for load().


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61056
    
  66

If you're going to be dealing with forms, you definitely want to check out the official jQuery Forms Plugin.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Will do.
Thanks, Bear.


BTW: Should questions like this go here or in the Other Open Source Projects forum? The book promos always seem to end up here so it was my first guess.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

That worked.
I dismissed serializeArray because the description that I saw on one of the API pages didn't really describe this behavior. Got a good reference page that you use?

I have a book on order but it's not here yet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61056
    
  66

Originally posted by Ben Souther:
Should questions like this go here

Here. JavaScript questions would be best addressed here.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61056
    
  66

Originally posted by Ben Souther:
I dismissed serializeArray because the description that I saw on one of the API pages didn't really describe this behavior.

Yeah, the online docs for some of the methods is rather lame -- especially for newer methods like serializeArray() which was just added.
 
Don't get me started about those stupid light bulbs.
 
subject: Getting JQuery's serialize and load function to play together.