Created
October 15, 2017 15:13
-
-
Save wadewegner/912fb0985db4a70b60fcd649fe48e093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function poll() { | |
var complete = false; | |
$.ajax({ | |
url: "/api/test", | |
type: "GET", | |
success: function (data) { | |
var message = data.message; | |
if (message === 'yes') { | |
complete = true; | |
status('complete: ' + data.message); | |
} | |
}, | |
dataType: "json", | |
complete: setTimeout(function () { | |
if (!complete) { | |
status('polling'); | |
poll(); | |
} | |
}, 1000), | |
timeout: 2000 | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment