Welcome Guest, Not a member yet? Register   Sign In
AJAX / Post / delete record not working
#15

@Gary thanks for your comment.

I have rewritten the jquery ajax per below and I can now getVar!!! The only problem now is getting the 'id' to my model.

Here is my jquery ajax:

$(document).on('click', '.delete-task', function(event){
let id = $(event.currentTarget).attr('data-id');
data = {};
name = 'id';
value = id;
data[name] = value;
$.ajax({
url: ajaxUrl+'/admin/tasks/delete',
type: 'post',
data: data,
success: function(data) {
console.log(data);
alert("hi"+JSON.stringify(data));
}
});
});

In my old script, I was not formatting the 'date' correctly. It was previously showing up in the payload tab (chrome devtools) as id=103. With the above script, the payload now show 'id: 103'.

All working now. Than you all for you comments and suggestions.
Reply


Messages In This Thread
RE: AJAX / Post / delete record not working - by spreaderman - 06-25-2022, 05:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB