]> git.mxchange.org Git - mailer.git/blobdiff - js/ajax-common.js
Fix for 'next/previous' navigation
[mailer.git] / js / ajax-common.js
index 113864a9ee58b7b626fcba27c4034058b76bd9d6..df1eb32fe1d4609bfff86678ea2f85eb9c77a94a 100644 (file)
@@ -152,25 +152,19 @@ function setAjaxSuccess (success) {
 
 // Set AJAX reply and decode JSON if requested
 function setAjaxReply (reply, isJson) {
-       // Copy reply to local variable
-       var localReply = reply;
-
        // Is it JSON URL-encoded content?
        if ((isJson != undefined) && (isJson == true)) {
-               // Then decode it, replace '%20' with space before because '%20' breakes JSON content
-               var obj = jQuery.parseJSON(reply.replace('%20', ' '));
+               // Decode URL-encoding (for some reason it must be here ...)
+               var localReply = decodeUrlEncoding(reply);
 
-               // Is reply_content there
-               if (obj.reply_content == undefined) {
-                       // Not defined
-                       throw new 'obj.reply_content not returned from ajax.php, please fix your scripts.';
-               } // END - if
+               // Then decode it, replace '%20' with space before because '%20' breakes JSON content
+               var obj = jQuery.parseJSON(localReply.replace('%20', ' '));
 
                // ... and set it
-               setAjaxDecodedContent(obj.reply_content);
+               setAjaxContent(obj);
        } else {
                // Handle the content over to decode it
-               setAjaxDecodedContent(localReply);
+               setAjaxDecodedContent(reply);
        }
 }
 
@@ -272,7 +266,7 @@ function requestAjaxContent (prefix, htmlId, tabId, footerNavigation) {
                // Fade the old content out
                $('#' + htmlId).fadeOut('fast', function() {
                        // Send AJAX request
-                       if (sendAjaxRequest(prefix, 'request_content', '&tab=' + tabId, true) == true) {
+                       if (sendAjaxRequest(prefix, 'request_content', '&tab=' + tabId, false) == true) {
                                // Add the HTML content
                                $('#' + htmlId).html(getAjaxContent());
 
@@ -495,11 +489,17 @@ function doFooterPage (prefix, htmlId, button) {
        //* DEBUG: */ alert('doFooterPage(): button=' + button + ',currentTabId=' + currentTabId + ',nextPage[currentTabId]=' + nextPage[currentTabId]);
        if ((button == 'next') && (nextPage[currentTabId] != null)) {
                // Then call the AJAX requester
-               requestAjaxContent(prefix, htmlId, nextPage[currentTabId]);
+               var page = nextPage[currentTabId];
        } else if ((button == 'previous') && (previousPage[currentTabId] != null)) {
                // Then call the AJAX requester
-               requestAjaxContent(prefix, htmlId, previousPage[currentTabId]);
+               var page = previousPage[currentTabId];
        }
+
+       // Request AJAX content
+       requestAjaxContent(prefix, htmlId, page);
+
+       // Change the footer navigation
+       enableFooterNavigation(prefix, page);
 }
 
 // Allows to save made changes (this will be called if the onchange event has been triggered)