Intercept FORM submit

Nakaci se na ‘submit’ event, napravi nesto sa vrijednostima i dodaj novi input koji ce se submitati

$(document).on('submit', 'form', function (e) {
    e.preventDefault();

    var form = $(this),
        elements_to_submit = $('[name]', this),
        signed_values = nv.crypto.sign({
            exclude_elements: ['__RequestVerificationToken'],
            hash_fn: nv.crypto.hash.simpleHash,
            elements_to_sign: elements_to_submit
        });

    form.append('<input type="hidden" name="signedValues" value="' + signed_values + '">');

    this.submit();
});

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.