我正在使用ajax请求,并且我收到了来自AJAX的响应的JSON对象。 现在我正在尝试缓存该JSON对象以及如何从缓存中获取数据。我希望使用具有相同参数值的相同请求向下一个请求显示缓存数据。
self.categorySelected = function (selectedCategory, event) {
$.ajax({
url: '/services/ShopService.asmx/XGetRefurbishedproducts',
data: JSON.stringify({ displayName: itemDisplayName, categoryid: selectedCategory.CategoryId(), language: lang }),
type: "POST",
dataType: "json",
cache: true,
contentType: "application/json; charset=utf-8",
beforeSend: function () { $(event.target).prop('disabled', true); }
}).done(function (data) {
//sample
})
}