주석 시스템 용 JavaScript가 있습니다. 그러나 클래스 이름이 "com_submit"인 제출 단추를 클릭하면 페이지가 다시로드되는 것 외에는 아무 것도 발생하지 않습니다. 양식을 비워두고 알림을 제출하더라도 팝업은 표시되지만 그렇지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까? , .live 내가 .click 사용하여 시도했다.click 함수가 작동하지 않습니다.
$(function() {
$('.com_submit').live("click", function() {
var comment = $("#comment").val();
var user_id = $("#user_id").val();
var perma_id = $("#perma_id").val();
var dataString = 'comment='+ comment + '&user_id='+ user_id + '&perma_id=' + $perma_id;
if(comment=='') {
alert('Please Give Valid Details');
}
else {
$("#flash").show();
$("#flash").fadeIn(400).html('<img src="ajax-loader.gif" />Loading Comment...');
$.ajax({
type: "POST",
url: "commentajax.php",
data: dataString,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:first").fadeIn("slow");
$("#flash").hide();
}
});
}
return false;
});
});
예상대로 작동하고 이러한 작업
버튼 선언을 제공 할 수 있습니까? – Praveen
예 버튼이 있습니다 :'' – Sygon