Add callback to and settimeout functions to prevent race conditions with write

This commit is contained in:
Nathan Leniz
2015-01-28 02:22:12 -05:00
parent adf1d30fee
commit 7ea08f3074
3 changed files with 26 additions and 12 deletions

View File

@@ -51,10 +51,6 @@ $(document).ready(function() {
url: '/completed-bonfire/'
});
//$.post( '/completed-bonfire', function( data ) {
// window.location = '/bonfires';
//});
}
}
@@ -71,13 +67,18 @@ $(document).ready(function() {
window.location = '/challenges/' + (parseInt(l[l.length - 1]) + 1);
});
$('.next-bonfire-button').on('click', function() {
var bonfireSolution = myCodeMirror.getValue();
var thisBonfireHash = passedBonfireHash || null;
var didCompleteWith = $('#completed-with').val() || null;
completedBonfire(didCompleteWith, bonfireSolution, thisBonfireHash);
window.location = '/bonfires';
window.setTimeout(function() {
// TODO
window.location = '/bonfires';
}, 100);
});