Skip to content
Advertisement

Ajax ignoring URL

I try to make an ajax request through JQuery triggering an onClick event, but when it sends the AJAX request I receive:

PATCH http://localhost:8000/courses 405 (Method Not Allowed) (Current page) Because it doesn’t get the URL with the id

HTML

JavaScript

JQUERY + AJAX

JavaScript

WEB.PHP

JavaScript

ROUTES Routes

EDIT

If I use POST instead of PATCH in type AJAX gets the id.

Found a GitHub issue with the same problem https://github.com/jquery/jquery/issues/3944

Advertisement

Answer

I forgot to put this condition at the start of the update method in the controller… Now it works!

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement