I am trying to update some data via ajax in laravel 5, But I am facing MethodNotAllowed Http Exception.
So, I have created a resource route in web.php, an HTML form to get some data prefilled in the textboxes, and some ajax code.
Code For Web.php, prefixed via admin.
Route::resource('settings', 'OrganisationSettingsController', ['only' => ['edit', 'update', 'index', 'change-language']]);
Html Form Code
{!! Form::open(['id'=>'editSettings','class'=>'ajax-form','method'=>'PUT']) !!}
//Input Elements Goes Here...
{!! Form::close() !!}
Ajax Call code
$('#save-form').click(function () {
$.easyAjax({
url: '{{ route('admin.settings.update', ['1']) }}',
container: '#editSettings',
type: "POST",
redirect: true,
file: (document.getElementById("logo").files.length != 0 || document.getElementById("login_background").files.length != 0) ? true : false
})
});
When User Click on the update button the data must be updated, but I got http method not allowed exception in browser's console.