Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# jstree:无限加载符号_C#_Asp.net Mvc_Jstree - Fatal编程技术网

C# jstree:无限加载符号

C# jstree:无限加载符号,c#,asp.net-mvc,jstree,C#,Asp.net Mvc,Jstree,我尝试在视图中获取文件夹树 <script type="text/javascript"> $(document).ready(function () { $.getJSON("/Home/GetJsonData", null, function (data) { var tree = JSON.stringify(data); $('#demo').jstree({

我尝试在视图中获取文件夹树

    <script type="text/javascript">
        $(document).ready(function () {
            $.getJSON("/Home/GetJsonData", null, function (data) {
                var tree = JSON.stringify(data);
                $('#demo').jstree({
                    'core': {
                        'data': tree
                        //'data': [{ "id": "1", "text": "L1" }] --> this is working
                    }
                })
            })
        });
    </script>
我得到了我的json字符串,但是当我调用json.stringify(data)并传递它时,我在视图中得到了一个无休止的加载图标

    <script type="text/javascript">
        $(document).ready(function () {
            $.getJSON("/Home/GetJsonData", null, function (data) {
                var tree = JSON.stringify(data);
                $('#demo').jstree({
                    'core': {
                        'data': tree
                        //'data': [{ "id": "1", "text": "L1" }] --> this is working
                    }
                })
            })
        });
    </script>

$(文档).ready(函数(){
$.getJSON(“/Home/GetJsonData”),null,函数(数据){
var-tree=JSON.stringify(数据);
$('#demo').jstree({
“核心”:{
“数据”:树
//'data':[{“id”:“1”,“text”:“L1”}]-->这正在工作
}
})
})
});
我正在呼叫的控制器:

    public JsonResult GetJsonData()
    {
        var persons = new List<Person>
        {
            new Person { id = "1", text = "AAAAA" }
        };
        return Json(persons, JsonRequestBehavior.AllowGet);
    }
publicjsonresult GetJsonData()
{
var persons=新列表
{
新人{id=“1”,text=“AAAAA”}
};
返回Json(persons,JsonRequestBehavior.AllowGet);
}

或者这是一种完全错误的处理方式?

除非您发布“数据”的结构和内容,否则我们无法知道确切的问题。原因是循环引用。为什么要将服务器响应字符串化?似乎您需要一个对象来存储
core>数据
propertyThank you Nikolay。这就是重点。我非常关注JSON字符串。。。