vendredi 29 mai 2015

Loop over json list generated by oracle procedure

I'm trying to run a loop over a json list generated by oracle procedure:

Control:

  public JsonResult GetLOVDivCount()
        {
            return Json(SearchRep.GetDivCount(), JsonRequestBehavior.AllowGet);
        }

Model:

        public static GetLovListModel GetDivCount()
        {
            var p = new OracleDynamicParameters();
            p.Add("p_output", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
            string spName = "p_get_div_count";
            GetLovListModel glist = new GetLovListModel();
            using (var grid = DB.GetMultiGrid(spName, p: p))
            {
                glist.GetDivCount = grid.Read<GetDivCount>().ToList();
            }
            return glist;
        }

View:

$.ajax(
         {
             url: '@Url.Action("GetLOVDivCount")',
             type: 'GET',
             datatype: 'json',
             success: function (result) {
                 **jQuery.each(result, function(key,val){
                     $("#tDivCount").last().append("<tr><td>" + result + "</td><td>New row</td><td>New row</td></tr>");**
                 })
                 
             }
         });

But the table is showing only null data!? Please advise.

Aucun commentaire:

Enregistrer un commentaire