如果我有這樣的JSON響應驗證使用JSON - 阿賈克斯
{"error":"repeated"}
爲什麼警報沒有顯示?它需要放在某個地方dataType: "json"
?
$(function() {
$("#box a").click(function() {
var selectedId = $(this).attr("class");
$.post("new_list.php", {
id_user: <?php echo $id;?>,
id_list: selectedId
}, function (data) {
if(data.error == 'repeated') {
alert("error");
}
});
});
});
感謝