永不言弃!
不忘初心:感恩的心!上进的心!

1. .net中Controller里面的方法

        /// <summary>
        /// 流程图
        /// </summary> 
        /// <returns>返回对象Json</returns>
        [HttpGet]
        public ActionResult GetFlowChartJson()
        { 
            Dictionary<string, string> newsInfo = new Dictionary<string, string>();

            PA_AssessCycleEntity assessCycleEntity = assessCycleBLL.GetEntity("");
            string state = assessCycleEntity.State.ToString();
            if (state == "0") 
                newsInfo.Add("0", "考核已终止");
            else
                newsInfo.Add("1", "考核已启动");
             return ToJsonResult(newsInfo);
        }            

 

2. json中读取上面的Dictionary,主要是使用for in 读取,如下图所示。

    var vList;
    //获取后台数据:流程图
    $.ajax({
        url: contentPath + "/Home/GetFlowChartJson",
        type: "get",
        dataType: "json",
        async: false,
        success: function (data) {
            vList = data;
        }
    });
    for (var i in vList)
    {
        alert('编码='+i +'  文本='+ vList[i]);
    } 

 

posted on 2017-05-23 14:27  永不言弃!  阅读(2798)  评论(0编辑  收藏  举报