Laravel AJAX PUT update request only works in localhost

I can't figure out why this block of code only works on my localhost, in my production server the requests goes through and $request->input() returns an empty array but in my localhost it works perfectly fine. Both on version php7. Any thoughts ?

var formData = new FormData($('#postSliderFrm')[0]);

if(imagePicked)
    formData.append('file',imagePicked);

formData.append('_method', 'put');

$.ajax({
    type: 'PUT',
    url: '{{route('dashboard.admin.sliders.update', $slider->id)}}',
    data: formData,
    processData: false,
    contentType: false,
    success: function(data) {

    },
    error: function(data) {

    }
});

I've also tried adding

{!! method_field('put') !!}

inside my form but still no luck


当使用PUT在AJAX上使用Laravel资源时,不允许使用方法 :请看一下,使用GET或更常用的POST来处理这个问题可能会更好,您是否需要专门使用PUT?

链接地址: http://www.djcxy.com/p/41040.html

上一篇: Laravel 5.2不同的路由类型

下一篇: Laravel AJAX PUT更新请求只适用于本地主机