我从服务器做一个Ajax请求后,下面的响应:使用JSON响应
{"error":false,"success":true}
我的Ajax代码:
$.ajax({
url: '/update',
type: 'post',
data: $(this).serialize(),
success: function(response) {
alert(response)
},
error: function() {
alert('An error occured, form not submitted.');
}
});
,而不是提醒整个响应我要提醒在这种情况下,“成功”的价值将是真实的。这个怎么做?
你必须解析JSON到一个JavaScript对象:http://stackoverflow.com/questions/4935632/how-to-parse-json-in-javascript –