【发布时间】:2009-05-06 18:16:30
【问题描述】:
仍在使用 JQuery 来获取数据并重新填充页面的某些部分。现在我无法让它返回数据,但它确实弹出一个错误,说“数据未定义”。
代码:
var retrieveData2 = function(path, productGroup, productType, itemsPerPage, pageIndex, filters, fnHandleCallback) {
$.getJSON(path
, { productGroup: productGroup, productType: productType, itemsPerPage: itemsPerPage, pageIndex: pageIndex, filter: filter }
, function(data) { fnHandleCallback(data); });
};
function updateNavIndex(pageIndex) {
var filters = $("form").serialize();
var productGroup = $("#valProductGroup").attr('title');
var productType = $("#valProductType").attr('title');
var itemsPerPage = $("#ItemsPerPage").val();
retrieveData2("/CatalogAjaxController/UpdateNavigation", productGroup, productType, itemsPerPage, pageIndex, filters, handleMenuData(data));
}
function handleMenuData(data) {
$("#CatalogPagingMenu").remove();
// [http://ejohn.org/blog/javascript-micro-templating/][apply data to template]
}
当调用 updateNavIndex 函数时,我收到“Microsoft JScript 运行时错误:‘数据’未定义”的错误。
我错过了什么?
啊!更接近(现在有 1 票的答案)- 尚未进行服务器调用。它直接进入回调处理程序。 :(
大部分情况下都能正常工作。我的 URL 指向 CatalogAjaxController。它应该指向 CatalogAjax,因为 MVC 知道它是一个控制器。
【问题讨论】:
标签: jquery asp.net-mvc