export const form = () => {
    let initTest = new Validations('#test')

    initTest.request((form) => {
        const formCurrent = $(`#${form.id}`),
            formAction = form.action,
            formMethod = form.method

        $.ajax({
            url: formAction,
            type: formMethod,
            data: formCurrent.serialize(),
            contentType: false,
            processData: false,
            beforeSend: function () {
                new CreatePreloader(form.id)
            },
            success: function (response) {
                new RemovePreloader(form.id, response.message, response.status)
            },
            error: function (response) {
                new RemovePreloader(form.id, response.statusText + ' ' + response.responseText, response.status)
            },
            complete: function () {},
        })
    })
}
