Still working through JQuery to get data and repopulate portions of a page. Right now I cannot get it to return data but it does pop an error saying "data is undefined".
Code:
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]
}
when the updateNavIndex function is called I get an error of "Microsoft JScript runtime error: 'data' is undefined".
What am I missing?
ah! closer (the answer with 1 vote right now) - yet no server call is being made. It goes directly to the callback handler. :(
Got it working for the most part. My URL was pointing at CatalogAjaxController. It should point to CatalogAjax as MVC knows it is a controller.