Sadly... no. If I were to do that then I would get double escaped data...
The code that converts an object to a serialized form is already calling encodeURIComponent on the key names and the values... (see http://dev.jquery.com/browser/trunk/jquery/src/ajax.js line 454ish) -ben On Dec 6, 3:27 pm, "Benjamin Sterling" <[EMAIL PROTECTED]> wrote: > I am doing something encodeURIComponent(url) in a wordpress plugin, would > that help? > > On 12/6/07, Ben Bennett <[EMAIL PROTECTED]> wrote: > > > > > > > Sadly. That doesn't do it either. > > > I am deliberately trying to send a ? (since the bug occurred when a > > user typed it into an input box that I use as the basis of an AJAX > > request). The bug occurs because jQuery is treating =? as a special > > string, but it can happen for mundane reasons, and there is no way to > > disable the behavior. > > > -ben > > > On Dec 6, 11:30 am, "Benjamin Sterling" > > <[EMAIL PROTECTED]> wrote: > > > Ben, (its like talking to myself) > > > Put cache:true into your ajax call, the ? is to prevent caching. > > > > On 12/6/07, Ben Bennett <[EMAIL PROTECTED]> wrote: > > > > > Is this the wrong forum for this question? Should I take it to the > > > > dev list or put it in the bug tracker? > > > > > Thanks, > > > > > -ben > > > > > On Dec 4, 2:00 pm, Ben Bennett <[EMAIL PROTECTED]> wrote: > > > > > This is my first post so I really should thank everyone for a > > > > > fanatastic library. > > > > > > However, I think I have found a bug... > > > > > > Using jQuery 1.2.1, if I have: > > > > > > $.ajax({ > > > > > type: "POST", > > > > > url: "test.html", > > > > > dataType: "json", > > > > > data: {query: queryString}, > > > > > > }); > > > > > > When queryString starts with a ? it will get converted to > > > > > jsonp1231234124... > > > > > > This is clearly happening because of the code at line 2226 of the > > full > > > > > release version: > > > > > // Build temporary JSONP function > > > > > if ( s.dataType == "json" && (s.data && > > > > > s.data.match(jsre) || s.url.match(jsre)) ) { > > > > > jsonp = "jsonp" + jsc++; > > > > > > // Replace the =? sequence both in the query > > > > > string and the data > > > > > if ( s.data ) > > > > > s.data = s.data.replace(jsre, "=" + > > > > > jsonp); > > > > > s.url = s.url.replace(jsre, "=" + jsonp); > > > > > > ... > > > > > > But I see no way to prevent that from happening. > > > > > > Now... one might suggest that I should avoid a leading ? in my > > option > > > > > names. But I am taking them from input boxes and ? is a valid thing > > > > > for a user to type. Unfortunately there seems to be no good way to > > > > > escape the string to prevent this behavior (without teaching the > > > > > called code how to unescape it). > > > > > > Also, the docs don't mention that the =? escaping happens to a json > > > > > dataType... I see it for jsonp. > > > > > > Is this behavior intentional? If so, there should be a way to > > > > > suppress it or at a way for the calling code to escape the values to > > > > > cause a leading ? to be passed to the server. > > > > > > -ben > > > > -- > > > Benjamin > > Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjam... > > -- > Benjamin > Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjaminsterling.com