I have a function that will check a serialized form data if there are duplicates values in it.
    s = $('#multiselectForm').serialize();
    var x = [];
    var y = [];
    x = s.split("&");
    for (var i = x.length - 1; i >= 0; i--) {
        y.push(x[i].split("="));
    };
    var c = 0;
    var e = 0;
    for (var i = y.length - 1; i >= 0; i--) {
        if (y[i][1] == y[c][1]) {
            e++;
            $('.duplicateAlert').show();
        } else {
            $('.duplicateAlert').hide();
        };
        c++;
    };
Basically, what it does is split the string produced by the serialize() function and push the data into arrays.
The array I'm trying to parse looks like this:
Array [
    Array [
    0: 'my_field1',
    1: 'val1'
    ],
    Array [
    0: 'my_field2'
    1: 'val2'
    ],
    Array [
    0: 'my_field3'
    1: 'val1'
    ]
]
Are there any better ways to do the same task? Maybe even shorter?
 
     
    