The GET method is not supported for this route. Supported methods: POST. laravel 5.8 Ajax

I faced the same problem once, Where the issue resides auto redirection from http to https. So the url I changed to https itself while calling api.


It looks like you are not including the name key in your POST data. Try this:

$.ajax({
    method: 'POST', // Type of response and matches what we said in the route
    url: '{{ route('jsonTest') }}', // This is the url we gave in the route
    data: {'name' : 'testing'}, // <-- this is your POST data
    success: function(response){ // What to do if we succeed
        console.log(response);
    },
    error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
        console.log(JSON.stringify(jqXHR));
        console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
    }
});