我有:
<script>
$('#email').on('blur', function(){
email = $(tihs).val();
$.ajax({
type: "POST",
url: "ajax.php",
data: {
'email': email,
'job': 'check',
},
dataType: "JSON",
success: function (response) {
// the response from PHP is smth like:
// {"status":"failed","reason":"email_not_validated"}
// now I want to:
if(response.status == 'success'){
}else{
}
}
})
});
</script>
这似乎适用于除IE之外的每个浏览器 ,为什么会这样?
我做对了吗?我唯一需要的是访问返回的数据,如response.status
和response.reason
。
感谢您的帮助