
$("#registrationForm").on('submit', function (e) {
    e.preventDefault();

    var data = {
        NAME: $('#name').val(),
        MOBILE_NO: $('#mobile_number').val(),
        EMAIL_ID: $('#email_id').val(),
        PASSWORD: $('#Password').val(),
        CONFIRM_PASSWORD: $('#Confirm_Password').val(),
        DOB: $('#dob').val(),
        ADDRESS_1: $('#address1').val(),
        ADDRESS_2: $('#address2').val()
    };
    console.log("Data before AJAX request:", JSON.stringify(data));
    $.ajax({
        type: "post",
        url: "/registration",
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(data),
        success: function (response) {
            alert('User registered successfully.');
            console.log(response);
            // Handle success response
        },
        error: function (response) {
            alert('User registration failed. ' + response.responseJSON.error);
            console.log("error");
        },
    });
});