2

Is it possible to cache the template passed into jTemplates? I am loading table data via setInterval every minute and it grabs the template each time, only 1.6kb, but still. From the jTemplates Documentation it seems to accept a caching object but I don't see it working / I think its how I am passing the options object.

    $.ajax({ type: "POST",
        url: "ExternalContent.asmx/RecentOpps",
        async: true,
        contentType: "application/json; charset=utf-8",
        data: "{}",
        dataType: "json",
    success: function (msg) {
        $(".jqOppInfo").setTemplateURL("xml/RecentOppTemplate.htm", {}, { cache: true });
        $(".jqOppInfo").processTemplate(msg);
        $(".jqToolTip").tooltip({ track: true });
    }
});
  • Callbacks and options:
    • jQuery.fn.processTemplateURL: type - 'GET' or 'POST', default: 'GET' data - Data to be sent to the server. Default: undefined dataFilter - A function to be used to handle the raw response data of XMLHttpRequest. Default: undefined async - asynchronous AJAX, default: true cache - use cache, default: false timeout - Set a local timeout in ms for the request. on_success [event] - Run after success on_error [event] - Run on error on_complete [event] - Run after success and error
AdamRoof
  • 264
  • 2
  • 11

0 Answers0