2
If you remove the line marked below it will definitely work.
In a dict of params for ajax you are putting a console.log which is completely wrong.
$.ajax({
url: "/reserve/",
type: "POST", //Send the info to reserve view
data: {
pk: pk
},
dataType: "json",
console.log('form submitted') <-- remove this line
success: function (result) {
if (result.result == 'clear') {
$(this).toggleClass("free reserved");
$.toast({
heading: "Reservation Clear!",
icon: 'success',
stack: 4,
hideAfter: 2000,
bgColor: '#003366',
});
};
Note: if you want to debug your code then you can put a beforesend
like function from ajax which would help in debug that whatever you are passing or what is your flow of js code.
Source:stackexchange.com