I'm saving data with the help of ajax and laravel. In the form the text field data is saving but the file is not saving with the help of ajax.
This is my script.

<script>
    $(document).ready(function() {
    $('#ajax').submit(function(event){
        event.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'post_contact',
            data: $('form#ajax').serialize(),
            dataType: 'json',
        })

        .done(function(data) {
            console.log(data); 
        });
        return false;
    });
});
    </script>
Member Avatar for diafol

Sending files via ajax is not this straightforward. You may need a 3rd party script like that from PLUpload or BlueImp.

Ok thankyou.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.