On Thu, Jan 14, 2010 at 3:39 PM, John Resig <jere...@gmail.com> wrote:
> You can just use the traditional style of serialization. Just set: > jQuery.ajaxSettings.traditional = true; > --- Part 1 --- The Subject says jQuery 1.3.2 ; But the serialization changes with the upcoming 1.4. There(1.4) you'll get the old(1.3.2) behavior by setting .traditional = true. See also here: http://groups.google.com/group/jquery-dev/browse_thread/thread/9e11a4c0c4cf89ac BUT this does not change the quoting (urlencoding) behavior of $('#form1').serialize(), only certain aspects of the $.param() function(?) -- which is used for serializing javascript objects. With decodeURIComponent($('...').serialize()) you will get the raw brackets. But for POST or GET this is not necessary, as the urlencoding will be stripped server-side before any further processing, so what PHP/... shouldn't see any difference between a url-encoded request (for completeness: there a some subtleties for URL parts before and including the '?' for GETs, AFAIK) and one without encoding (when possible/allowed for the characters). So jQuery should not cause any problems here. BTW I tried with PHP and the print_r() output seemed wrong (included the brackets) at first. var_dump() differentiates formatting from contents better. --- Part 2 --- @John, Ben: I expected jquery.ajaxSettings.traditional === false by default. But it isn't (in 1.4rc1), its undefined. Also in http://github.com/cowboy/jquery/commit/4ea851e08841447ba3550dc54785b3c026a5560f the test case says in Line 263 equals( !jQuery.ajaxSettings.traditional, true, "traditional flag, falsy by default" ); but !undefined is also true. Note that in Line 175 of src/ajax.js the traditional: false, appears only inside a comment. This looks like a bug. Tobias On Thu, Jan 14, 2010 at 3:03 AM, Ishbir <ishbi...@gmail.com> wrote: > > How to replicate the problem- > > > > 1. Create a form with an input field, the name of which includes > > [ and ]. For e.g. Shout[message]. > > 2. Try to serialize the form and display the value using the > > javascript alert function. The square brackets of the name attribute > > will be html encoded however that behavior is not desired since the > > name should not change while the value of the text field should be > > html encoded. > > > > A workaround- > > > > Use a separate function to replace the html codes of the square > > brackets back to the original brackets. > > > > Please fix this problem in the next version. :) >--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.