A jQuery plugin to transform <a> tags into restful POST/PUT/UPDATE requests
0: Load jQuery
1: Load restfulizer.js
<script type="text/javascript" src="restfulizer.js"></script>2: Add appropriate data-method attribute to your <a> tags
<a href="/user/3" data-method="post">POST</a>
<a href="/user/3" data-method="put">PUT</a>
<a href="/user/3" data-method="delete">DELETE</a>
<a href="/user/3" data-method="delete" data-confirm="false">sudo DELETE</a>3 Run restfulize()
$('a').restfulize();$('a').restfulize({
post_query: true, // Send query vars as part of POST body (default `true`)
method: 'post', // Request method, GET/POST/PUT/DELETE
action: '/endpoint?var=val', // If using href attribute isn't an option
confirm: 'Are you sure?' // Prompt text to confirm DELETE. Set to "false" to disable
});Make sure your <head> contains csrf-token meta tag, it will get fwd as _token var in POST
<meta name="csrf-token" content="{{ csrf_token() }}">See example.html for examples