我有这个应该触发 mvc 函数调用的 jquery,
$(document).ready(function () {
alert("ddddd");
$("#divJsTreeDemo").jstree({
"plugins": ["json_data"],
"json_data": {
"ajax": {
"type": "POST",
"url": "/WebTree/GetTreeNodes",
"async": true,
"contentType": "application/json; charset=utf-8",
"dataType": "json",
"data": function (node) {
return "";
},
sucess: function (retval) {
var d = "";
},
error: function (retval) {
alert(retval);
}
}
}
});
});
但我不断收到一条错误消息,提示“您要查找的资源已被删除、名称已更改或暂时不可用。”
当我将它发送到服务器时,我得到了错误的 json 吗?
这是mvc控制器,
Public Class WebTreeController
Inherits System.Web.Mvc.Controller
'
' GET: /WebTree
Function Index() As ActionResult
Return View()
End Function
Public Function GetTreeNodes() As JsonResult
Dim list As New List(Of String)
list.Add("dddd")
'Dim jsonString As String = Encoding.Default.GetString(list.ToArray)
Return Me.Json(list)
End Function
End Class