Hi,
We are using MVC/JQuery for one web application: In one the screen users can generate charts. Now requirement as below:
1) Select Chart Criteria. (Client/Date Range/Chart Axis etc)
2) Press “Generate” Button… Which further makes a call to JQuery and then get the Data from Server through Ajax Call.
3)
public JsonResult GetDayData([DataSourceRequest]DataSourceRequest request,
string clientID, DateTime? startDate, DateTime? endDate, string SortOrder))
{
//Makes a call to Stored Procedure
Stored procedure runs and return multiple datatables (ds.tavles[0], ds.tables[1] etc.
}
4) Based on these datatables we need to refresh/create 4-5 charts (assuming 4-5 datatables will be returned from stored procedure)
5) I am able to return dataTable[0] and create chart but I am not able to find how to return multiple Json objects in one call and how to handle those in JQuery/Ajax.
One approach is to make separate for each chart controller and return Json objects but I don’t want to make multiple calls to Stored procedure.
Any suggestions how I can return multiple dataTable/or class objects from MVC to Ajax Call?
e.g: Each Json objects can have a same or different structure
DataTable 1: {Category: “A”, Points:20, Percentage:87}
{Category: “B”, Points:20, Percentage:87}
DataTable 1: {Category: “A”, Spots:20, Percentage:87,ExtraInfo: “NA”}
{Category: “B”, Spots:20, Percentage:87,ExtraInfo: “NA”}
Thanks
[{ dt1: { /* stuff */ }, dt2: { /* stuff */ } }];