I’m trying to find an efficient way to convert all ampersands in form inputs to something else (maybe a ~ or something) before $("#myForm").serialize()ing a form. The reason for this is that I’m splitting the resulting string on the & character, and then the = character, to get a list of names and values.
This system works fine, except, obviously, when one of the values contains an ampersand.
I’ve been trying to think of ways to globally replace all &s in a form, but I can’t think of anything that seems at all efficient.
Maybe this?
Example