(function ($) {
    'use strict';

    /**
     * Panda Json Async Response Service
     * @type {void|Object|*}
     */
    Panda.Http.Jar = $.extend(true, Panda.Http.Jar || {}, {
        init: function () {
            Panda.Http.Jar.FormAsync.init();
        },
        request: function (serverUrl, method, requestData, sender, loading, options) {
            // Set ajax extra options
            var ajaxOptions = {};
            ajaxOptions.dataType = 'json';
            ajaxOptions.loading = loading;
            ajaxOptions.withCredentials = true;

            // Extend options
            ajaxOptions = $.extend(true, ajaxOptions, options);

            // Use new function
            return Panda.Http.Async.request(serverUrl, method, requestData, sender, ajaxOptions).then(function (response) {
                return Panda.Http.Jar.handleResponse(response);
            });
        },
        downloadRequest: function (downloadUrl) {
            // Create HTMLFrame to download content
            var frameID = 'dlfi' + Math.round(Math.random() * 10000000);
            var jqFrame = Panda.Ui.HTMLFrame.create(downloadUrl, '', frameID, 'dl_frame', null);
            jqFrame.css('display', 'none').appendTo('body');
        },
        handleResponse: function (response) {
            // Check if report is not null
            if (!response) {
                Panda.Console.log('The server report is empty. Aborting content parsing.');
                return reject('The server report is empty. Aborting content parsing.');
            }

            // Check report integrity
            if (response.headers === undefined) {
                Panda.Console.log('Server Report does not contain a header element. Aborting content parsing.');
                return reject('Server Report does not contain a header element. Aborting content parsing.');
            }
            return response.content;
        }
    });
})(jQuery);

@@ -258,24 +258,25 @@
      %7D,%0A
+%0A
         
 request:
@@ -271,33 +271,393 @@
     
-request: function (server
+/**%0A         * Make an ajax request and expect the response to be a Jar response.%0A         *%0A         * @param %7Bstring%7D ajaxUrl%0A         * @param %7Bstring%7D method%0A         * @param %7Bobject%7D requestData%0A         * @param %7Bobject%7D sender%0A         * @param %7Bboolean%7D loading%0A         * @param %7Bobject%7D options%0A         * @return %7BPromiseLike%3CT%3E%7D%0A         */%0A        request: function (ajax
 Url,
@@ -1084,22 +1084,20 @@
 request(
-server
+ajax
 Url, met
@@ -1253,24 +1253,25 @@
      %7D,%0A
+%0A
         
 download
@@ -1266,332 +1266,218 @@
     
-downloadRequest: function (downloadUrl) %7B%0A            // Create HTMLFrame to download content%0A            var frameID = 'dlfi' + Math.round(Math.random() * 10000000);%0A
+/**%0A         * Handle an async Jar response.%0A         * The response must have headers and content, according to https://github.com/PandaPlatform/jar%0A  
        
+*%0A
      
-var jqFrame = Panda.Ui.HTMLFrame.create(downloadUrl, '', frameID, 'dl_frame', null);%0A            jqFrame.css('display', 'none').appendTo('body');
+    * @param response%0A         * @return %7B*%7D
 %0A   
@@ -1481,18 +1481,19 @@
         
-%7D,
+ */
 %0A       
@@ -1643,36 +1643,38 @@
 g('The server re
+s
 po
-rt
+nse
  is empty. Abort
@@ -1741,20 +1741,22 @@
 erver re
+s
 po
-rt
+nse
  is empt
@@ -1926,36 +1926,38 @@
 e.log('Server Re
+s
 po
-rt
+nse
  does not contai
@@ -2045,20 +2045,22 @@
 erver Re
+s
 po
-rt
+nse
  does no
@@ -2126,24 +2126,25 @@
           %7D%0A
+%0A
             
@@ -2168,16 +2168,1170 @@
 ontent;%0A
+        %7D,%0A%0A        /**%0A         * Make an ajax request in the form of download.%0A         * It performs the download by opening an iFrame with the given downlaod url.%0A         *%0A         * @param %7Bstring%7D downloadUrl%0A         */%0A        downloadRequest: function (downloadUrl) %7B%0A            // Create HTMLFrame to download content%0A            var frameId = 'dl_frame_' + Math.round(Math.random() * 10000000);%0A            var jqFrame = this.getFrame(downloadUrl, '', frameId, '');%0A            jqFrame.css('display', 'none').appendTo('body');%0A        %7D,%0A%0A        /**%0A         * Create a simple iFrame element%0A         * @param %7Bstring%7D src%0A         * @param %7Bstring%7D name%0A         * @param %7Bstring%7D frameId%0A         * @param %7Bstring%7D frameClass%0A         * @return %7BHTMLElement%7D%0A         */%0A        getFrame: function (src, name, frameId, frameClass) %7B%0A            // Create item object%0A            var frameItem = $('%3Ciframe/%3E').attr('id', frameId).addClass(frameClass);%0A%0A            // Add source, name and sandbox%0A            frameItem.attr('name', name);%0A            frameItem.attr('src', src);%0A%0A            // Return item%0A            return frameItem;%0A
         

Update Jar download request to build its own frame when needed