イベントjquery
を使用して ajax リクエストを行う:success
$.ajax("/subscribe/email", {
type: 'POST',
dataType: 'json',
data: {
email: $("#e").val()
},
success: function(result) {
console.log(result.err);
}
});
問題はresult.err
未定義ですが、応答はjson
あり、このプロパティを持っています。
{
"err": "Some error message goes here."
}
経由で JavaScript オブジェクトのプロパティにアクセスするにはどうすればよいですかresult
。