ACC SHELL

Path : /srv/www/vhosts/csmap/assets/js/min/
File Upload :
Current File : //srv/www/vhosts/csmap/assets/js/min/registration-form.min.js

$(document).ready(function() {
	var hashParams = window.location.hash.substr(1).split('&');
	for(var i = 0; i < hashParams.length; i++){
		var p = hashParams[i].split('=');
		$('#'+ p[0]).val(decodeURIComponent(p[1]));
	}
	
});

$(function() {

    // Get the form.
    var form = $('#ajax-registration');

    // Get the messages div.
    var formMessages = $('#form-messages');

    // Set up an event listener for the contact form.
    $(form).submit(function(event) {
        // Stop the browser from submitting the form.
        event.preventDefault();

        if (!$('#souhlas').is(":checked"))
        {
            $(formMessages).addClass('error');
            $(formMessages).text(errorMess);
            return false;
        }

        // Serialize the form data.
        var formData = $(form).serialize();

        // Submit the form using AJAX.
        $.ajax({
            type: 'POST',
            url: $(form).attr('action'),
            data: formData
        })
            .done(function(response) {
                // Make sure that the formMessages div has the 'success' class.
                $(formMessages).removeClass('error');
                $(formMessages).addClass('success');

                // Set the message text.
                $(formMessages).text(response);

                $('#code').val('');
                $('#souhlas').prop('checked', false);
                $("#img_code").attr("src", $("#img_code").attr("src")+"?timestamp=" + new Date().getTime());

                // Clear the form.
                //$('#name').val('');
				//$('#firm').val('');
                //$('#email').val('');
                //$('#phone').val('');
				
				//$('#product').val('mipro');
				//$('#version').val('');
				//$('#snumber').val('');
				//$('#newhwid').val('');
                //$('#message').val('');
            })
            .fail(function(data) {
                // Make sure that the formMessages div has the 'error' class.
                $(formMessages).removeClass('success');
                $(formMessages).addClass('error');

                // Set the message text.
                if (data.responseText !== '') {
                    $(formMessages).text(data.responseText);
                } else {
                    $(formMessages).text('Oops! An error occured and your message could not be sent.');
                }
            });

    });

});

ACC SHELL 2018