The issue is pretty straight forward, I can not reference $(this)
in the success section of my jQuery ajax call, for example this does not work (to hide the clicked element):
$('.assigned').click(function (event) {
event.preventDefault();
$.post("@Url.Action("method", "controller")",
{
TicketId: $(this).data("ticketid"),
},
function (data, status) {
$(this).hide();
});
});
its worth noting the data is sent. However this hides the element just fine:
$('.assigned').click(function (event) {
event.preventDefault();
$(this).hide();
$.post("@Url.Action("method", "controller")",
{
TicketId: $(this).data("ticketid"),
},
function (data, status) {
});
});
Why is this happening?
Tested in FireFox