mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 06:44:33 +02:00
Add a serializeObject jQuery funtion
This commit is contained in:
parent
ad0432f3be
commit
48913767d3
@ -42,11 +42,12 @@
|
|||||||
}
|
}
|
||||||
})(console);
|
})(console);
|
||||||
|
|
||||||
/* Get class list */
|
/* jQuery Plugins */
|
||||||
(function ($) {
|
(function ($) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/* Get class list */
|
||||||
$.fn.classes = function (callback) {
|
$.fn.classes = function (callback) {
|
||||||
|
|
||||||
var classes = [];
|
var classes = [];
|
||||||
@ -73,4 +74,22 @@
|
|||||||
return classes;
|
return classes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Serialize form elements to an object */
|
||||||
|
$.fn.serializeObject = function()
|
||||||
|
{
|
||||||
|
var o = {};
|
||||||
|
var a = this.serializeArray();
|
||||||
|
$.each(a, function() {
|
||||||
|
if (o[this.name] !== undefined) {
|
||||||
|
if (!o[this.name].push) {
|
||||||
|
o[this.name] = [o[this.name]];
|
||||||
|
}
|
||||||
|
o[this.name].push(this.value || '');
|
||||||
|
} else {
|
||||||
|
o[this.name] = this.value || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return o;
|
||||||
|
};
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user