を受けた私はxmlhttp.responseJSONを取得することはできませんよ、のJavaスクリプトでスクリプトを以下のJavascript AJAX応答からオブジェクトを取得することができ作業ではなくは
// Below is the Ajax call for get http methods
function callAjaxGet(url, callback){
var xmlhttp;
// compatible with IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
console.log('+++++++++++++++++++++++++++');
console.log(xmlhttp['responseJSON']);
console.log(xmlhttp.responseJSON);
callback(xmlhttp.responseJSON);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
を試してみましたが、それが応答に移入なっています、私は火かき棒の窓でそれを見ることができます。それにアクセスすることはできません。
私は、次のいずれかを呼び出すことにより、機能の上に使用しています。
window.onload = function() {
url = "/user/getAll";
var data = callAjaxGet(url, function(responseJSON) {
// on success call back.
console.log(responseJSON);
});
}
私はこの最後の数時間を探していますが、まだ成功していません。
**何のロギングは動作しません、私は 'undefined'見るけどresponseJSON –
があなたの' .onreadystatechange'を定義すると、私は全体のXMLHTTPオブジェクトを印刷する場合、私は、ロギングでそれを見ることができます(xmlhttp.readyState == 4 && xmlhttp.statusの== 200){ はconsole.log( '場合**の後には '(...).open使用して' ... – KarelG
@KarelGは –