Jump to content
jimfog

serialize or not?

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...