1
$.getJSON(_routes['salesInAMonthJS'], { month: "September 2016" }).then(
function(d){
console.log(d);
}
);
이
$.getJSON(_routes['salesInAMonthJS'], { month: "September 2016" });
는 날 다시 제공
{"9":{"name":"alex lloyd","country":"Germany","antiquity":"new client","amount":"0.0 USD"},"10":{"name"
:"asdasdsadasda dasda","country":"Afghanistan","antiquity":"new client","amount":"0.0 USD"},"11":{"name"
:"Alex Lloyd","country":"American Samoa","antiquity":"new client","amount":"0.0 USD"},"12":{"name":"alex
lloyd","country":"Aruba","antiquity":"new client","amount":"0.0 USD"},"5":{"name":"surgeon bueno","country"
:"Spain","antiquity":"renewal","amount":"2686.97 USD"}}
그러나 때 사용자를 버튼을 클릭하면 저장된 데이터를 표시하고 싶습니다. d
:
$(document).on("click ", ".tick", function(e) {
e.preventDefault();
$.each(d, function(i, item) {
&("div.container").append(d[i].name);
});
});
그러나이 모든 아이디어를 작동하지 않는 것 내가 무엇을 잘못하고 있어요? 감사합니다
'& ("div.container")'는'$ ("div.container")'의 오타입니다. – Barmar
가변 범위 문제가 있습니다. 'd'는'$ .getJSON' 콜백 함수에 국한되어 있으므로 다른 함수에서 액세스 할 수 없습니다. – Barmar