I have a set of sessions in a page, which I want to remove using AJAX. i.e click on a link, and without having to navigate for a new page, just remove the session, and show
After your comment to @Laurent Wartel's answer, I assume now you get Uncaught SyntaxError: Unexpected token }
. Now it's clear, you have additional parentheses on end of your click()
function.
In addition, you don't wait for document to load before binding click()
event.
Because of this, jQuery tries to bind event to element that wasn't yet rendered. This is a common pitfall.
To run your code after page loads, you have to wrap it info $(function() { ... }
.
Please, read full explanation here as this is basic, yet very important.
To sum up, correct code is as follows:
It seems like somehow you've deleted that line during debugging, because it is there in your original question, but is not present in source code you've sent later.