I'm trying to create a chart page that updates every 5 seconds based on flotr2. But I'm having some problems with the return from the server, I get
[object, Object],[object, Object],[object, Object],[object, Object],[object, Object],[object, Object],[object, Object]
The javascript looks like:
function updateFunc() {
new Ajax.Request('http://localhost:53083/Home/Data', {
method: 'get',
onSuccess: function (transport) {
var json = transport.responseText.evalJSON();
alert(json);
}
});
}
updateFunc();
And the asp.net/c# looks like:
//
// GET: /Home/Data
public string Data()
{
dt.Rows.RemoveAt(0);
dt.Rows.Add(rand.Next(1, 50));
return JsonConvert.SerializeObject(dt);
}
dt is just a static datatable where i remove the first and add a new, creating a feel of continuous update.
What is wrong? As posted all i get is the [object, Object]
from the alert.