JavaScript
18
Вклад в тег
$.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;
};
var fieldValue = $('input[name="name"]').val();
function get_unique_array(array1, array2) {
return array1.filter(function(val) {
return array2.indexOf(val) != -1;
});
}
var
arr_1 = ['a', 'b', 'c'],
arr_2 = ['b', 'c', 'd', 'e'];
console.log(get_unique_array(arr_1, arr_2)); // ["b", "c"]