答案提交加入超时处理
This commit is contained in:
parent
45c51ef8db
commit
b356c6cd1f
|
@ -32,30 +32,34 @@ $(function(){
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(
|
||||
'/student_work/program_test',
|
||||
{homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test},
|
||||
function(data,status){
|
||||
tested = true;
|
||||
console.log(data);
|
||||
if(data.index <=0){
|
||||
data.index = $('.ProResultTop').length+1;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/student_work/program_test',
|
||||
type: 'POST',
|
||||
timeout: 60*1000,
|
||||
data: {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test}
|
||||
}).done(function(data){
|
||||
tested = true;
|
||||
console.log(data);
|
||||
if(data.index <=0){
|
||||
data.index = $('.ProResultTop').length+1;
|
||||
}
|
||||
if (typeof cb == 'function') {cb(data); return;}
|
||||
var html=bt('t:result-list',data);
|
||||
$('.ProResult').prepend(html);
|
||||
|
||||
if (typeof cb == 'function') {cb(data); return;}
|
||||
|
||||
|
||||
var html=bt('t:result-list',data);
|
||||
$('.ProResult').prepend(html);
|
||||
|
||||
if (data.status==0 && is_test != 'true') {
|
||||
var r=confirm("答题正确,是否立刻提交?");
|
||||
if (r) {
|
||||
$(".HomeWorkCon form").submit();
|
||||
}
|
||||
if (data.status==0 && is_test != 'true') {
|
||||
var r=confirm("答题正确,是否立刻提交?");
|
||||
if (r) {
|
||||
$(".HomeWorkCon form").submit();
|
||||
}
|
||||
}
|
||||
);
|
||||
}).fail(function(xhr, status){
|
||||
if(status == 'timeout'){
|
||||
alert("您的答案超时了, 请检查代码是否存在死循环的错误.");
|
||||
} else {
|
||||
alert("测试失败,服务器出错.")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$('#test-program-btn').on('click', test_program);
|
||||
|
|
Loading…
Reference in New Issue