showing results for - "laravel ajax file"
Isobel
15 Mar 2018
1$.ajaxSetup({
2    headers: {
3        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
4    }
5});
6
7//click function // this ajax call include file/image/etc
8let formData = new FormData(form);
9$.ajax({
10    type:'POST',
11    url:'{{ route('url') }}',
12    data: formData,
13    contentType: false,
14    processData: false,
15    cache: false,
16    beforeSend: function() {
17        $("#full_loading").show();
18    },
19    success: (response) => {
20        if (response) {           
21            if(response.param == true) {          
22                window.location.href = "{{ route('url','id') }}".replace("id", response.id);    
23            }
24        }
25    },
26    error: function(response){
27        console.log(response);
28    }
29});