I understand, maybe this is a slight mistake. But already a lot of time I can’t solve it.
There is a table with a delete button in each table record, when the button is clicked, an ajax request should be sent, but this generates an error.
Function call button
& lt; td data-label = "Remove" & gt;
& lt; a href = "#" onclick = "removeItemFromCart ('Click!')" data-line = "0" data-id = "6154534944950" class = "cart__remove icon icon-x text-right large - text-center "& gt; & lt; / a & gt;
& lt; / td & gt;
ajax
& lt;! - AJAX request - & gt;
& lt; script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type = "text / javascript" & gt; & lt; / script & gt;
& lt; script & gt;
$ (document) .ready (function () {
function removeItemFromCart (id) {
alert (id)
}
});
& lt; / script & gt;
Answer 1, authority 100%
Here is crossover question neighbors. As in this question, I also wonder why ready is needed in this situation? ready is meant to execute some code only after the DOM has loaded. But why do you need to declare functions in it?