Skip to content

Instantly share code, notes, and snippets.

@lucassmacedo
Last active March 11, 2020 03:13
Show Gist options
  • Save lucassmacedo/17fc8c9dfbd12b40284e31be14f9f133 to your computer and use it in GitHub Desktop.
Save lucassmacedo/17fc8c9dfbd12b40284e31be14f9f133 to your computer and use it in GitHub Desktop.
$.ajax({
url: 'http://localhost/item/1/delete',
type: 'DELETE',
dataType: "JSON",
data: {
"id": 1,
},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function (data) {
console.log(data);
//$("#url" + url_id).remove();
},
error: function (data) {
console.log('Error:', data);
}
});
@vitorhugomattos
Copy link

$.ajax({
    url: 'http://localhost/item/' + id,
    type: 'DELETE',
    data: {
        "id": id, 
        "_token": $('meta[name="csrf-token"]').attr('content')
    },
    success: function (data) {
        console.log(data);
    },
    error: function (data) {
        console.log('Error:', data);
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment