Hi
In controller i had written json code .My json Code is
public JsonResult Get()
{
var data = new {
Id = "1",
Name="prasanna",
Duration="8years",
TrainingYear="2005",
Comments="good comments" };
return Json(data,JsonRequestBehavior.AllowGet);
}
In My view i use
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css" />
<script type="text/javascript" src="../../dhtmlx/dhtmlx.js"></script>
<link rel="STYLESHEET" type="text/css" href="../../dhtmlx/dhtmlx.css" />
</head>
<body onload="doOnLoad()">
<div id="form_container" style="width:250px;height:300px;"></div>
<script type="text/javascript">
var myForm, formData;
function doOnLoad() {
formData = [
{ type: "fieldset", name: "data", label: "Welcome", inputWidth: "auto", list: [
{ type: "input", name: 'id', label: 'Id' },
{ type: "input", name: "Name", label: "Name" },
{ type: "input", name: "Duration", label: "Duration" },
{ type: "input", name: "Training year", label: "Training Year" },
{ type: "input", name: "comments", label: "Comments" },
{ type: "button", name: "submit", value: "submit", id:"submit"}]
}
]
myForm = new dhtmlXForm("form_container", formData);
}
</script>
</body>
</html>
<script type="text/javascript">
var user={
'id':1
};
$('#display').click(function(){
$.get(
'Home/Get',
user,
function(data)
{
alert(data.Name);
}
});
);
</script>
<body>
<form>
<input type="submit" id="display" name="display"/>
</form>
</body>
but am not getting values