Parallel Runtime Transactions for Multiple Ajax Templates

If you use multiple secondary Ajax templates within one primary template, you need to create a snippet that will allow performing parallel runtime transactions:

  1. Create a new snippet.
  2. Copy and paste the code below into your snippet.
<script>

Flamingo.Ajax.jQuery = (function(self, $) {

self.prefilter = function(successCb, errorCb) {
return function(options, originalOptions, jqXHR) {

jqXHR.options = options; jqXHR.originalOptions = originalOptions;

var originalSuccess = originalOptions.success || options.success; var originalError = originalOptions.error || options.error;

options.success = successCb || function(data, dataType, jqXHR) {
if (jqXHR.responseText) {
Flamingo.Ajax.processHTMLString(options.url, jqXHR.responseText, function(res) {
originalSuccess && originalSuccess(res);

});

} else {
originalSuccess && originalSuccess(data);

}

};

options.error = errorCb || originalError;

};

};

self.catchAjaxRequests = function(successCb, errorCb) {
$.ajaxPrefilter(Flamingo.Ajax.jQuery.prefilter(successCb, errorCb));

};

return self;

})(Flamingo.Ajax.jQuery || {}, jQuery);

Flamingo.Ajax.jQuery.catchAjaxRequests();

</script>

  1. Call this snippet before the BODY tag on a page where you want to use multiple Ajax templates.