When I $.post() the values of a form, if one of the values start with
any of "()[]{}", then the associated form element name has a semi-
colon appended to it when I finally extract the POST data in my PHP
script.

The Javascript:

        var formValues = $("#formName").serialize();
        alert( formValues );
        $.post( "something.php", { "someStuff" : "foobar", "formValues" :
formValues }, function( data ) { ... } );

The text displayed in the alert dialog is "Number=(555)+555-1234";
this is the expected value.

In something.php:

        $formValues = $_POST["formValues"];
        echo $formValues;

The outputted text is "Number;=(555)+555-1234". Note the insertion of
a semi-colon to the end of the form element's name. This only happens
when one of the bracket characters is the first non-space character
(i.e. " (" will cause the same results as if the space was removed).
If the form value starts with anything else, then no semi-colon is
added.

My PHP script is being called through CodeIgniter, but I don't
immediately see anything in its code that would cause the addition of
the semi-colon. At first I thought it was a safeguard when handling
data that might have JSON delimiters contained within, but the value
comes through unchanged; it's only its name that is modified.

Is this a jQuery issue, or does my bug lie elsewhere? Thanks!

- Jeff

Reply via email to