live
메서드를 사용하려고하고 처음에는 의도 한대로 작동하지만 ajax 'success'콜백은 이후의 함수 실행시 제대로 작동하지 않습니다..html live() Jquery와 함께 작동하지 않습니다
$(function() {
$('.vote').live('click', function() {
url = '".base_url()."post/vote';
post_id = $(this).attr('id');
$.ajax({
url: url,
type: 'POST',
data: 'post_id=' + post_id,
success: function (msg) {
post = $('.num_vote' + post_id);
vote = $('.votes' + post_id);
$(vote).html(msg); // working only the first time
}
});
return false;
});
});
자바 스크립트 파일에서 PHP를 사용하고 있습니까? – putvande
jQuery 1.7부터 .live() 메소드는 더 이상 사용되지 않습니다. – orhanhenrik
'$ (vote) .html (msg)'에 투표의 변수 또는 오타가 있습니까? –