如果我有这样的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");
}
});
});
});
感谢