Bug Tracker

Opened 15 years ago

Closed 14 years ago

#1516 closed enhancement (fixed)

.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: [email protected]
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)

load-string.diff (360 bytes) - added by flesler 14 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 15 years ago by john

Component: coreajax

comment:2 Changed 14 years ago by flesler

Owner: set to flesler
Status: newassigned

Changed 14 years ago by flesler

Attachment: load-string.diff added

comment:3 Changed 14 years ago by flesler

Milestone: 1.1.41.3
Resolution: fixed
Status: assignedclosed

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

Thanks.

Note: See TracTickets for help on using tickets.