Skip to main content

Bug Tracker

Side navigation

#1516 closed enhancement (fixed)

Opened August 19, 2007 01:48PM UTC

Closed May 27, 2008 10:47PM UTC

.load - add support for standard key/value pairs string as a parameter

Reported by: pops Owned by: flesler
Priority: major Milestone: 1.3
Component: ajax Version: 1.1.3
Keywords: Cc: jeresig@gmail.com
Blocked by: Blocking:
Description

Problem:

.load(url, parameter,,) has an obstrusive and ambiguious design of requiring the parameter to be an OBJECT format. If a string is provided, as I believe most new jQuery application developers would assume to use, especially when the documentation those use the phase "(optional) A set of key/value pairs that will be sent as data to the server", then .load will incorrectly sent a strung out string of key/value pairs for each character in the string parameter.

Solution:

.load uses jQuery.param() to convert an Array or JSON Object into KV pairs.

A possible solution is to add String data type detection support in jQuery.param() like so:

if (a.constructor == string) {

// we got what we want, no more transformations required

}

else

if ( a.constructor == Array || a.jquery )

....

This will allow for a more natural and "unobstrusive" design for developers.

NOTE:

If this is considered for implementation, the AJAX request when passing a string parameter SHOULD remain as a GET and not a POST.

Attachments (1)
Change History (3)

Changed December 11, 2007 05:03PM UTC by john comment:1

component: coreajax

Changed May 15, 2008 09:06PM UTC by flesler comment:2

owner: → flesler
status: newassigned

Changed May 27, 2008 10:47PM UTC by flesler comment:3

milestone: 1.1.41.3
resolution: → fixed
status: assignedclosed

The necessary changes were applied at [5701] and additional tests at [5702].

Thanks.