I used serialize() to get form values, for getting values back i split the serialized string, but the values are uri encoded, like ‘@’ is replaced by ‘%40’, i used decodeURIComponent() to decode, the issues looked like solved but still i am getting spaces replaced by ‘+’ sign. can use string.replace() but it would replace my legitimate ‘+’ signs in the string. How to achieve it?
I used serialize() to get form values, for getting values back i split the
Share
If there are legitimate
+in the string it will already be encoded as%2B. So before calllingdecodeURIComponent()on the string replace all the+which represent the space in the string by space and then calldecodeURIComponent()to decode the string.Use this code
Demo