Needed a way to put data pulled from my API (via Django REST Framework) into a variable for graphing.
jQuery.extend({
getValues: function(url) {
var result = null;
$.ajax({
url: url,
method: 'GET',
async: false,
success: function (data) {
result = data;
}
});
return result;
}
});
Using this I can make a simple call in my scripts and pull back the data I need (in this case for generating graphs using Plot.ly)
var something = $.getValues('/api/something')