In the past I have used the following method to parse the json data appropriately so I can populate a select box:
var request = null;
request = $.ajax({
type: "POST",
url: "url goes here",
dataType: 'text',
success: function(returned){
returned = JSON.parse(returned)
$.each(returned, function(selectid,item)
{
var sel = $("#"+selectid).get(0);
sel.options.length=0;
$.each(item, function(i,subitem){
sel.options[i]=new Option(subitem.text, subitem.value);
});
});
request = null;
}
});
How do I apply the same technique to the code below, but without a select box, just parse the json into the drawChart function?
$.ajax({
url: 'chart_json.aspx',
type: 'POST',
dataType: 'text',
success: function(data) {
drawChart(data);
}
});