when the page loads I want to get a json as so:
$.getJSON(_routes['salesInAMonthJS'], { month: "September 2016" }).then(
function(d){
console.log(d);
}
);
this
$.getJSON(_routes['salesInAMonthJS'], { month: "September 2016" });
gives me back
{"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"}}
However when a user clicks a button I want to display the data stored in d
for example:
$(document).on("click ", ".tick", function(e) {
e.preventDefault();
$.each(d, function(i, item) {
&("div.container").append(d[i].name);
});
});
However this doesn't seem to work, any idea what I'm doing wrong? Thanks