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
f1c8b3ff
Commit
f1c8b3ff
authored
May 17, 2006
by
Gilles van den Hoven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixxed the form serialize function as seen on the mailing list.
parent
956529c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
ajax.js
ajax/ajax.js
+28
-10
No files found.
ajax/ajax.js
View file @
f1c8b3ff
...
@@ -139,13 +139,29 @@ $.fn.load = function(a,o,f) {
...
@@ -139,13 +139,29 @@ $.fn.load = function(a,o,f) {
};
};
/**
/**
* function:
$.fn.formValues
* function:
$.fn.formValues
* usage:
$('#frmLogin').formValues()
* usage: $('#frmLogin').formValues()
* docs:
Gets the form values and creates a key=>value array of the found values (only
for ENABLED elements!)
* docs:
Gets form values and creates a key=>value array of the found values (
for ENABLED elements!)
*/
*/
$
.
fn
.
formValues
=
function
()
{
$
.
fn
.
formValues
=
function
()
{
var
a
=
[];
var
a
=
[];
this
.
find
(
"input[@type='submit'],input[@type='hidden'],textarea,input[@checked],input[@type='password'],input[@type='text'],option[@selected]"
).
filter
(
":enabled"
).
each
(
function
()
{
this
.
find
(
"input,textarea,option"
)
.
filter
(
":enabled"
)
.
each
(
function
()
{
//
// Skip selects with options which aren't selected
if
(((
this
.
parentNode
.
type
==
'select-one'
)
||
(
this
.
parentNode
.
type
==
'select-multiple'
))
&&
(
!
this
.
selected
))
return
;
//
// Skip radio and checkbox elements which aren't checked
if
(((
this
.
type
==
'radio'
)
||
(
this
.
type
==
'checkbox'
))
&&
(
!
this
.
checked
))
return
;
//
// All other elements are valid ;)
var
o
=
{};
var
o
=
{};
o
.
name
=
this
.
name
||
this
.
id
||
this
.
parentNode
.
name
||
this
.
parentNode
.
id
;
o
.
name
=
this
.
name
||
this
.
id
||
this
.
parentNode
.
name
||
this
.
parentNode
.
id
;
o
.
value
=
this
.
value
;
o
.
value
=
this
.
value
;
...
@@ -155,11 +171,11 @@ $.fn.formValues = function() {
...
@@ -155,11 +171,11 @@ $.fn.formValues = function() {
};
};
/**
/**
* function:
$.update
* function:
$.update
* usage:
$.update('someJQueryObject', 'someurl', 'array');
* usage:
$.update('someJQueryObject', 'someurl', 'array');
* docs:
Mimics the ajaxUpdater from prototype. Posts the key=>value array to the url and
* docs:
Mimics the ajaxUpdater from prototype. Posts the key=>value array to the url and
*
puts the results from that call in the jQuery object specified.
*
puts the results from that call in the jQuery object specified.
*
--> If you set the blnNoEval to true, the script tags are NOT evaluated.
*
--> If you set the blnNoEval to true, the script tags are NOT evaluated.
*/
*/
$
.
update
=
function
(
objElement
,
strURL
,
arrValues
,
fncCallback
)
{
$
.
update
=
function
(
objElement
,
strURL
,
arrValues
,
fncCallback
)
{
$
.
post
(
strURL
,
arrValues
,
function
(
strHTML
)
{
$
.
post
(
strURL
,
arrValues
,
function
(
strHTML
)
{
...
@@ -170,7 +186,9 @@ $.update = function(objElement, strURL, arrValues, fncCallback) {
...
@@ -170,7 +186,9 @@ $.update = function(objElement, strURL, arrValues, fncCallback) {
//
//
// Evaluate the scripts
// Evaluate the scripts
objElement
.
html
(
strHTML
).
find
(
"script"
).
each
(
function
(){
objElement
.
html
(
strHTML
).
find
(
"script"
).
each
(
function
(){
try
{
$
.
eval
(
this
.
text
||
this
.
textContent
||
this
.
innerHTML
);
}
catch
(
e
){}
try
{
$
.
eval
(
this
.
text
||
this
.
textContent
||
this
.
innerHTML
);
}
catch
(
e
)
{
}
});
});
//
//
...
...
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