Hello — been reading up on how to do this and there are some posts for Craft 2, 3 — but I'm not sure what's out there works for Craft CMS 4. I am using the following JS to delete an entry. However I get an error in the console log that http://website.com/actions/entries/deleteEntry can't be found
. What am I doing wrong?
<script>
$('#delete-entry').click(function() {
window.csrfTokenName = "{{ craft.app.config.general.csrfTokenName|e('js') }}";
window.csrfTokenValue = "{{ craft.app.request.csrfToken|e('js') }}";
var data = {
entryId: '{{entry.id}}',
csrfTokenName: csrfTokenValue,
};
$.post('/actions/entries/deleteEntry', data, function(response) {
console.log('clickResponse', response);
}, 'json');
});
</script>