Jump to content

serialize or not?


jimfog
 Share

Recommended Posts

I have a series of inputs(and more can be added by clicking the plus icon):https://jsfiddle.net/fiddlehunt/pu4qqnrd/

In the left input user enters service(s) and in the right price(s) and these must be sent with AJAX to the server...

From a little search serialize() can do this but there is a problem.

suppose that the values to be sent are these:service1 and 55...service name and it;s price...take a look what is sent to the server.

form%5B0%5D%5Bservice%5D=service1&form%5B0%5D%5Bprice%5D=55

Many meaningless characters...is there something I can do to clean this string before or after it reaches the server or...

serialize() maybe not the best solution for this type of problem after all....what do you think?

Link to comment
Share on other sites

Those characters are not meaningless, they are 2-digit ASCII hex codes for characters that need to be escaped if they are in a URL.  From looking up which characters those are, it looks like it is using bracket notation for everything.  Maybe that means the form inputs don't have names.  I'm assuming you're using jQuery's serialize method, if you're using something else then clarify that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...