Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('html').append('<div id="overlay-loader"><img src="gfx/overlay-loader.gif" /><br />Downloading data...</div>');
- // Parse data
- var statisticsIsParsed = $.ajax({
- url: 'someurl',
- dataType: 'jsonp',
- cache: false,
- success: function (data) {
- $.when(test()).done(function() {
- rows = parseData(data);
- $('#overlay-loader').remove();
- });
- },
- error: function (jqXHR, errorStatus, message) {
- alert(message);
- }
- });
- function test() {
- var dfd = $.Deferred();
- $('#overlay-loader').html('<img src="gfx/overlay-loader.gif" /><br />Parsing...');
- // 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.
- //alert('wait');
- dfd.resolve();
- return dfd.promise();
- }
Add Comment
Please, Sign In to add comment