【发布时间】:2014-07-24 12:52:02
【问题描述】:
我正在尝试将 jsTree 3.0.2 中的参数传递给 aspx 页面上的 web 方法,但它没有命中 web 方法。但是,当没有参数时它确实有效。谁能指出我的方法的错误?
带参数(不工作):
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static IEnumerable<JsTreeNode> GetAll(string id)
{
// method does not get called
}
$("#jsTreeTest").jstree({
"core": {
"data": {
"url": "MyPage.aspx/GetAll",
"type": 'POST',
"dataType": 'JSON',
"contentType": 'application/json;',
'data': function (node) {
return { 'id': "01" };
}
}
}
});
无参数(工作):
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static IEnumerable<JsTreeNode> GetAll()
{
// successfully calls method
}
$("#jsTreeTest").jstree({
"core": {
"data": {
"url": "MyPage.aspx/GetAll",
"type": 'POST',
"dataType": 'JSON',
"contentType": 'application/json;',
"data": function (node) { return {}; }
}
}
});
谢谢。
【问题讨论】:
标签: c# asp.net web-services jstree