Guest User

Untitled

a guest
Jan 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. $('html').append('<div id="overlay-loader"><img src="gfx/overlay-loader.gif" /><br />Downloading data...</div>');
  2.  
  3. // Parse data
  4. var statisticsIsParsed = $.ajax({
  5. url: 'someurl',
  6. dataType: 'jsonp',
  7. cache: false,
  8. success: function (data) {
  9. $.when(test()).done(function() {
  10. rows = parseData(data);
  11. $('#overlay-loader').remove();
  12. });
  13. },
  14. error: function (jqXHR, errorStatus, message) {
  15. alert(message);
  16. }
  17. });
  18. function test() {
  19. var dfd = $.Deferred();
  20. $('#overlay-loader').html('<img src="gfx/overlay-loader.gif" /><br />Parsing...');
  21. // If I uncomment the alert the alertbox will appear and when I click ok the loader text has changed to "Parsing...". But without the alertbox the text won't change at all.
  22. //alert('wait');
  23. dfd.resolve();
  24. return dfd.promise();
  25. }
Add Comment
Please, Sign In to add comment