tags:

views:

63

answers:

1

Does the serialize function in jQuery replace dots ('.') with underscores?

For example, I have a form field such as:

<input id="Project.name" name="Project.name" type="text">

When the form is POSTed, I'm serializing the form data and sending it to another PHP file to save. The dots seem to be converted to underscores. Is this normal behavior?

+1  A: 

jQuery doesn't do this, the easiest way to see this is to test, you can see it here. It's been a loooong time since doing anything in PHP for me, but looks like something is happening server-side.

Here's a simple test:

<form>
  <input id="Project.name" name="Project.name" type="text" value="test" />
</form>

This jQuery:

alert($("form").serialize()); // "Project.name=test"

Another easy way to see what's actually's getting posted is Firebug, or any other traffic inspection tool of choice.

Nick Craver
Ah, correct, thank you sir. It is PHP that is messing with the data as explained here:http://php.net/manual/en/language.variables.external.phpThanks again!
Dave