Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
11761def
Commit
11761def
authored
May 28, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery ajax: small (misc) improvement to $.param.
parent
c6e88b16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
ajax.js
src/ajax.js
+8
-4
No files found.
src/ajax.js
View file @
11761def
...
@@ -486,14 +486,18 @@ jQuery.extend({
...
@@ -486,14 +486,18 @@ jQuery.extend({
// Serialize an array of form elements or a set of
// Serialize an array of form elements or a set of
// key/values into a query string
// key/values into a query string
param
:
function
(
a
)
{
param
:
function
(
a
)
{
var
s
=
[];
var
s
=
[
];
function
add
(
key
,
value
){
s
[
s
.
length
]
=
encodeURIComponent
(
key
)
+
'='
+
encodeURIComponent
(
value
);
};
// If an array was passed in, assume that it is an array
// If an array was passed in, assume that it is an array
// of form elements
// of form elements
if
(
a
.
constructor
==
Array
||
a
.
jquery
)
if
(
a
.
constructor
==
Array
||
a
.
jquery
)
// Serialize the form elements
// Serialize the form elements
jQuery
.
each
(
a
,
function
(){
jQuery
.
each
(
a
,
function
(){
s
.
push
(
encodeURIComponent
(
this
.
name
)
+
"="
+
encodeURIComponent
(
this
.
value
)
);
add
(
this
.
name
,
this
.
value
);
});
});
// Otherwise, assume that it's an object of key/value pairs
// Otherwise, assume that it's an object of key/value pairs
...
@@ -503,10 +507,10 @@ jQuery.extend({
...
@@ -503,10 +507,10 @@ jQuery.extend({
// If the value is an array then the key names need to be repeated
// If the value is an array then the key names need to be repeated
if
(
a
[
j
]
&&
a
[
j
].
constructor
==
Array
)
if
(
a
[
j
]
&&
a
[
j
].
constructor
==
Array
)
jQuery
.
each
(
a
[
j
],
function
(){
jQuery
.
each
(
a
[
j
],
function
(){
s
.
push
(
encodeURIComponent
(
j
)
+
"="
+
encodeURIComponent
(
this
)
);
add
(
j
,
this
);
});
});
else
else
s
.
push
(
encodeURIComponent
(
j
)
+
"="
+
encodeURIComponent
(
jQuery
.
isFunction
(
a
[
j
])
?
a
[
j
]()
:
a
[
j
]
)
);
add
(
j
,
jQuery
.
isFunction
(
a
[
j
])
?
a
[
j
]()
:
a
[
j
]
);
// Return the resulting serialization
// Return the resulting serialization
return
s
.
join
(
"&"
).
replace
(
/%20/g
,
"+"
);
return
s
.
join
(
"&"
).
replace
(
/%20/g
,
"+"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment