I understand your point but I think it might work better if the jsre regexp
was tweaked, instead:
jsre = /=(\?|%3F)(&|$)/g
Does making the above change work for you?
--John
On Fri, Jul 17, 2009 at 8:41 PM, Matthew M. Boedicker <
[email protected]> wrote:
>
> I like passing query string params to $.getJSON as an array using the
> optional data argument because it's more readable. However when using
> a jsonp callback parameter it gets encoded to callback=%3F, causing it
> to fail. Any way to accomplish this without modifying jquery?
>
> This patch to jquery made it work:
>
> --- jquery-1.3.2.js.orig 2009-02-19 18:02:00.000000000 -0500
> +++ jquery-1.3.2.js 2009-07-17 20:21:30.000000000 -0400
> @@ -3403,8 +3403,11 @@
> type = s.type.toUpperCase();
>
> // convert data if not already a string
> - if ( s.data && s.processData && typeof s.data !== "string"
> )
> + if ( s.data && s.processData && typeof s.data !== "string"
> ) {
> s.data = jQuery.param(s.data);
> + // reverse encoding of jsonp callback param
> + s.data = s.data.replace(/callback=%3F$/,
> "callback=?");
> + }
>
> // Handle JSONP Parameter Callbacks
> if ( s.dataType == "jsonp" ) {
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---