[eluser]cideveloper[/eluser]
What's with all the javascript questions in the codeigniter forums?
$(this) inside a .post returns the jquery post object not the object clicked. Do a console log on $(this) and you will see
Code:
$('a.trinti_img').live('click',function(e){
e.preventDefault();
$.post("test.php", {filename: name}, function(data){
console.log(data.response);
//$(this).parent().remove();
console.log($(this));
});
});
you need to get the element before you post.
Code:
$('a.trinti_img').live('click',function(){
name = this.id;
var elem_clicked = $(this);
jConfirm('Ar tikrai norite ištrinti?', 'Patvirtinimas', function(r) {
if(r){
$.post(CI.base_url + 'admin_/naujienos/delete_picture_ajax/'+name,{filename: name}, function(data) {
if(data != 'not_admin') //this is true
elem_clicked.parent().remove();
//console.log('test');
});
} //if r
});
return false;
});