I'm having a fuzzy brain day or something...I want to set a var = data returned from an ajax call and use it as a parameter in a morris chart.
function GetICCGraphData() {
return $.ajax({
url: "/url/"
});
}
$(function() {
var promise = GetICCGraphData();
Morris.Area({
element: 'icc-graph',
data: promise.success(function (data) { return data; }),
...<snip>...
the url returns JSON and if I hit the url manually and paste the data into data: <paste>
the chart works as it should...intially I tried to do it like one might think it should be...to just use the function as the value for data...then I got off on this 'promise' thing....so I just need to figure out how to make a variable equal data from an ajax call. Seems like it should be easy so I dunno, maybe I've just been staring at it for too long?
thanks people