Opened 15 years ago
Closed 15 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)
Change History (4)
comment:1 Changed 15 years ago by
Component: | core → ajax |
---|
comment:2 Changed 15 years ago by
Owner: | set to flesler |
---|---|
Status: | new → assigned |
Changed 15 years ago by
Attachment: | load-string.diff added |
---|
comment:3 Changed 15 years ago by
Milestone: | 1.1.4 → 1.3 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
The necessary changes were applied at [5701] and additional tests at [5702].
Thanks.