0

我有这个 JS 函数,它将调用下一个图像:

          function showNextManifest() {
              var currentManifest = jQuery('#selectedManifestId').val();
              jQuery.ajax({
                  url: "${createLink(action:'nextManifest')}?currentManifestId=" + currentManifest,
                  dataType: "json",
                  success: function(e) {
                      if (e.success) {
                          jQuery('#gotoPageNumber').val(e.pageNumber);
                          jQuery('#selectedManifestId').val(e.id);
                          jQuery('#popupManifestCustomItemId').val(e.id);
                          showLargeManifestViewer(e.url);
                      } else {
                          alert('No more additional frames for this roll.');
                      }
                  }
              });

          }

我想在图像显示之前放入 gif 预加载。这是否在 if (e.success) 之前?

4

1 回答 1

0

gif只需在 ajaxing 之前将加载器添加到您的容器中;我可以看到你的函数替换了 url。

  function showNextManifest() {
  showLargeManifestViewer('/loading.gif');
  //now it shows loader gif until ajax completed      

  var currentManifest = jQuery('#selectedManifestId').val();
              jQuery.ajax({
                  url: "${createLink(action:'nextManifest')}?currentManifestId=" + currentManifest,
                  dataType: "json",
                  success: function(e) {
                      if (e.success) {
                          jQuery('#gotoPageNumber').val(e.pageNumber);
                          jQuery('#selectedManifestId').val(e.id);
                          jQuery('#popupManifestCustomItemId').val(e.id);
                          showLargeManifestViewer(e.url);
                      } else {
                          alert('No more additional frames for this roll.');
                      }
                  }
              });

          }
于 2011-09-23T16:46:32.747 回答