Quote:
The POST method is not supported for this route. Supported methods: GET, HEAD.
That error means the endpoint you're calling doesn't support
POST
requests.
Quote:
when I change the method in ajax to "get", it does not send the parameter to controller
Whilst there's technically nothing in
RFC 7231 §4.3.1[
^] that forbids a GET request from having a body, it's virtually unheard of for any server to support it. Parameters to GET requests need to be passed in the URL or query-string.
I'm not familiar with Laravel, but it looks like your server-side method expects the parameter to be passed in the querystring.
$.ajax({
type: 'get',
url: "{{url('/fullname')}}?fullName=" + encodeURIComponent(fullName),
success: function(data) {
console.log(data);
},
error: function(data){
var errors = data.responseJSON;
console.log(errors);
}
});