Hi, I'm using asp.net mvc2 and trying to send a list of json objects with hard coded values from the home controller, and receive them in index.... in the code below i'm sending 1 json object .... how do i send many?
in home controller:
public ActionResult JsonValue()
{
var result = new
{
pID = 1,
pName = "Lina",
pStart = "",
pEnd = "",
pColor = "ff0000",
pLink = "",
pMile = 0,
pRes = "Brian",
pComp = 0,
pGroup = 1,
pParent = 0,
pOpen = 1
};
return Json(result,JsonRequestBehavior.AllowGet);
}
and receiving it in index like this:
var Jid = null;
var Jname = null;
var Jstart = null;
var Jend = null;
var Jcolor = null;
var Jlink = null;
var Jmile = null;
var Jres = null;
var Jcomp = null;
var Jgroup = null;
var Jparent = null;
var Jopen = null;
var Jtitle = null;
var g = new JSGantt.GanttChart('g', document.getElementById('GanttChartDIV'), 'day');
$(document).ready(function () {
$.getJSON('../../Home/JsonValue', function (data) {
Jid = data.pID;
Jname = data.pName;
Jstart = data.pStart;
Jend = data.pEnd;
Jcolor = data.pColor;
Jlink = data.pLink;
Jmile = data.pMile;
Jres = data.pRes;
Jcomp = data.pComp;
Jgroup = data.pGroup;
Jparent = data.pParent;
Jopen = data.pOpen;
Jtitle = '|id= ' + Jid + '|Name: ' + Jname + '|Start: ' + Jstart + '|End: ' + Jend;
}); // end $.getJSON
thanks a million in advance... Lina