0
AJAX 호출을 수행하고 응답을 받으면 전송 버튼을 레이블로 바꾸기를 원합니다.하지만이 방법은 작동하지 않습니다. 나는 즉각적인 메시지를 받았다. Ajax 호출의 응답은 replacewith 명령이 실패합니다. Ajax 호출 후 JQuery replacewith가 작동하지 않음
당신은Replacewith 명령 .. 필자가하고 실수 무엇
$(this).closest('tr').find('input:label').replaceWith("<label for=\'success\'>SUCCESS</label>");
코드를 말해 주시겠습니까 :
$("#table_appl,#table_enfr,#table_det01,#table_det02,#table_det03,#table_det04,#table_det05,#table_datais").on("click", "input:submit", function(event) {
//alert('Hi')
//event.preventDefault();
var fieldvalue = $(this).closest('tr').find('input:text').val();
var fieldname = $(this).closest('tr').find('input:text').attr('name');
alert('fieldname = ' + fieldname)
alert('fieldvalue = ' + fieldvalue)
$.ajax({
type:"GET",
url:"/validate/",
data:{'fieldvalue':fieldvalue,'fieldname':fieldname},
success:function(data){
if (data == 'Y'){
var item = $(this).closest('tr').find('input:label')
alert("Gonna be replaced" + item);
$(this).closest('tr').find('input:label');
$(this).closest('tr').find('input:label').replaceWith("<label for=\'success\'>SUCCESS</label>");
}
alert("Response = "+ data);
}
});
return false;
})
가능한 복제본 [아약스를 통한 게시 변수] (http://stackoverflow.com/questions/21614055/passing-post-variables) -through-ajax) – Barmar