У меня есть код в jquery, который используется для удаления предыдущего тега div и следующего .pclass.Вот мой код:
$(".delete").bind("click",function(){
var c = confirm("You sure want to delete this?");
if(c){
/* $(this).next('.pclass').remove();
$(this).prev('.rurl').remove();
$(this).remove();*/
var text = $(this).prev('.rurl').text();
var idvalue = $(this).prev('.rurl').attr('id');
var id = idvalue.split("|");
$.ajax({
type: "POST",
url: "http://localhost:8080/cPEP_UI/Engine_rurl_delete",
data: "text="+text+"&eid="+id[1],
dataType: "json",
success: function(data) {
if(data.update == "success"){
$(this).next('.pclass').remove();
$(this).prev('.rurl').remove();
$(this).remove();
}
// $('#show').show();
//$('#show').html(data.update+" "+data.message).fadeOut(8000);
},
error:function(xhr,err){
//alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
$('#show').show();
// alert(xhr.responseText);
$('#show').html("responseText: "+xhr.responseText);
}
});
}
});
Когда я использую методы удаления перед вызовом функции $ .ajax, он работает нормально, но не тогда, когда я помещаю его в успех.Я проверил вывод, возвращаемый файлом сервлета.Работает нормально.Есть идеи?