Create Form
.container {
    background: #c4c8c5;
    background-size: cover;
    height: 100%;
    width : 50%;
    margin-bottom: 100px;
    /*text-align: center;*/
    display: flex;
    align-items: center;
    position: relative;
}
 
    jQuery(document).ready(function($) {
        // console.log(‘hello’);
        $(document).on(‘click’, ‘.submit’, function(e) {
            if($(“.test-user”)[0].reportValidity()) {
                e.preventDefault();
                $.ajax({
                    url: “https://ped-api.captainweb.xyz/get/token”,
                    dataType: ‘json’,
                    success: function(response) {
                        console.log(response);
                        
                        if (response.statusCode == 200) {
                            $(‘.csrf_token’).val(response.data.token);
                            
                            var query_string = window.top.location.search.substring(window.top.location.search.indexOf(“?”) + 1);
                            
                            $.ajax({
                                url: “https://ped-api.captainweb.xyz/post/newform”,
                                data: {
                                    “form_data”: $(“.test-user”).serialize(),
                                    //”campaign_data”: query_string
                                },
                                dataType: ‘json’,
                                method: ‘POST’,
                                // cors: true ,
                                // contentType:’application/json’,
                                // secure: true,
                                // headers: {
                                    //     ‘Access-Control-Allow-Origin’: ‘*’,
                                // },
                                success: function(response) {
                                    //console.log(response);
                                    if (response.statusCode == 200) {
                                        alert(response.message);
                                    } else {
                                        alert(response.error.description)
                                    }
                                },
                                error: function(error) {
                                    if (error.responseJSON.statusCode == 200) {
                                        alert(error.responseJSON.message);
                                    } else {
                                        alert(error.responseJSON.error.description)
                                    }
                                }
                            });
                        }
                    }
                });
            }
        });
    });

