Show element only if getJSON takes more than n milliseconds?
I have some JavaScript:
surveyBusy.show();
$.getJSON(apiUrl + '/' + id)
.done(function (data) {
...
surveyBusy.hide();
})
.fail(function (jqXHR, textStatus, err) {
...
surveyBusy.hide();
});
However, I'd like to only issue surveyBusy.show(); if $.getJSON takes more
than n number of milliseconds. You get a flicker otherwise. Is there a
callback on the getJSON api that can do this? I see nothing in the
documentation.
No comments:
Post a Comment