Before each request, be sure to include the Basic Authentication headers. You can do this by including a "beforeSend" function with each request, or by initializing the ajaxSetup script when your page loads as follows:
$.ajaxSetup({ beforeSend: function(xhr){ xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); } });
Use the POST, {'_method': 'OPTIONS} action when you want to find out which actions and fields are available for a particular resource or resource list.
Use the POST action when you want to query a resource or set of resources.
Use the POST action when you want to create a new resource.
Use the PUT action when you want to update a resource.
Use the PATCH action when you only want to update only some of the resource's fields.
The delete request permanently deletes internet resources. This cannot be undone.