Guest User

Untitled

a guest
Jan 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $('html').append('<div id="overlay-loader"><img src="gfx/overlay-loader.gif" /><br />Downloading data...</div>');
  2.  
  3. $.ajax({
  4. url: 'someurl',
  5. dataType: 'jsonp',
  6. cache: false,
  7. success: function (data) {
  8. $.when(test()).done(function() {
  9. rows = parseData(data);
  10. $('#overlay-loader').remove();
  11. });
  12. },
  13. error: function (jqXHR, errorStatus, message) {
  14. alert(message);
  15. }
  16. });
  17. function test() {
  18. var dfd = $.Deferred();
  19. $('#overlay-loader').html('<img src="gfx/overlay-loader.gif" /><br />Parsing...');
  20. // 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.
  21. //alert('wait');
  22. dfd.resolve();
  23. return dfd.promise();
  24. }
Add Comment
Please, Sign In to add comment