Reputation: 1007
i pass json value my controller is working i checked my controller using break points but my json is not working it didn't responding alert message also not working please some one helpme friends. . .
My jquery
$('#Group').change(function () {
var name = $('#Tournament').val();
$.post("/DataCollection/Fee", { name: name, group: $('#Group').val() }, function (result) {
alert('hai');
$('#Fee').val(result.value.Fees);
$('#Count').val(result.value.NoOfboys);
$('#CName').empty();
$('#CName').append($("<option></option>").html("--SELECT--"));
$.each(result.Cname, function (key, value) {
$('#CName').append($("<option></option>").html(value).val(value));
});
}, "json");
});
My Controller
public JsonResult Fee(string name, string Group)
{
var value = entity.TblClsGroups.FirstOrDefault(x => x.TName == name && x.GroupName == Group && x.RecordStatus == 1);
var Cname = entity.TblGroups.Where(x=>x.RecordStatus==1 && x.TName == name && x.GroupName == Group).Select(c=>c.Cid);
var getFee = new { Cname, value };
return Json(getFee, JsonRequestBehavior.AllowGet);
}
Upvotes: 0
Views: 109
Reputation: 3787
try this:
return Json(new { Cname = Cname, value = value }, JsonRequestBehavior.AllowGet);
and in view use them like result.Cname
and result.value
Upvotes: 1