이전 div 태그와 다음 .pclass를 삭제하는 데 사용되는 jquery 코드가 있습니다. Heres는 내 코드 :jquery는 요소를 제거하지 않습니다.
$(".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);
}
});
}
});
나는 제거 방법을 사용하고 $ 아약스 함수를 호출하기 전에, 그것을 잘 작동하고 있지만 성공 내부를 걸었습니다하지 않을 때. Servlet 파일에 의해 반환되는 출력을 확인했습니다. 괜찮 았어. 어떤 아이디어?
가 $의 범위가 (이) 때 성공을위한 함수 내에서 변경되지 않습니다
아래 코드를 시도? –