여기 내 함수의 :jQuery를 아약스 작동하지 않습니다
$(".home .up_0").click(function() {
$.post("includes/vote.php",
{truc : $(this).attr("id")},
function(data) {
if(data==1) {
$(this).parents('.home').find('.score_neutre').append(
$(this).parents('.home').find('.score_neutre').val()+1
);
} else {
alert("Error !");
}
},
"json"
);
});
내가 모든 작업을 클릭 만 (1 인 내가 그것을 2로 변경하려는)을 .score_neutre
값을 변경하지 않는 경우.
당신은 json 응답을 검색하고이를 문자열로 사용하고 있습니다. – yoda
Btw json은 {score : 12} 또는 {values : {score : 12}}와 같습니다 ( data.score 또는 data.values.score를 각각 참조). json을 연관 배열로 PHP에서 모든 것을 캡슐화하고 json_encode ($ array)를 사용하려면 json을 사용하지 마십시오. – MindStalker