• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you are looking for serializeArray() which will return a construct acceptable for load().
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're going to be dealing with forms, you definitely want to check out the official jQuery Forms Plugin.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic