fix only submit on user click

This commit is contained in:
Berkeley Martinez
2015-08-26 13:09:38 -07:00
parent 306551848c
commit 2c9ed16b7a
4 changed files with 22 additions and 24 deletions

View File

@@ -294,27 +294,26 @@ function showCompletion() {
', Attempts: ' + attempts);
var bonfireSolution = myCodeMirror.getValue();
var didCompleteWith = $('#completed-with').val() || null;
$.post(
$('#complete-courseware-dialog').modal('show');
$('#submit-challenge').click(function(e) {
e.preventDefault();
$.post(
'/completed-bonfire/', {
challengeInfo: {
challengeId: challenge_Id,
challengeName: challenge_Name,
completedWith: didCompleteWith,
challengeType: challengeType,
solution: bonfireSolution
}
challengeInfo: {
challengeId: challenge_Id,
challengeName: challenge_Name,
completedWith: didCompleteWith,
challengeType: challengeType,
solution: bonfireSolution
}
},
function(res) {
if (res) {
$('#complete-courseware-dialog').modal('show');
$('#complete-courseware-dialog').keydown(function(e) {
if (e.ctrlKey && e.keyCode == 13) {
$('#next-courseware-button').click();
}
});
}
if (res) {
window.location = '/challenges/next-challenge';
}
}
);
);
});
}
var resetEditor = function resetEditor() {