Hi I have the following code with jQuery:
function reject(id) {
$.ajax({
type: 'POST',
url: api_url,
data: { validation_id: '11', listing_id: id }
}).done(function(msg) {
alert(msg);
$("'#" + id + "'").remove();
});
}
everything works great except for the remove() part:
$("'#" + id + "'").remove();
which should remove the div where the listing info is, as it was just rejected. How can I make this work?
You don’t need to wrap your selector with additional
'. It should be just a string representing the selector –$("#"+id).remove();