forked from OpenDSA/OpenPOP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise1withJava.js
More file actions
37 lines (34 loc) · 1.08 KB
/
Exercise1withJava.js
File metadata and controls
37 lines (34 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict";
/*global alert: true, console */
function assess() {
//Here what should happen
//1- get the code written by the student
$('#container div').empty();
// Code from Dan to send the code of the student to the server
var data = {};
data.code = $('#studentCodeTextArea').val();
/* Send the data using post and put the results in a div */
jQuery.ajax({
url: "http://opendsa.cc.vt.edu/openpop/backend/api/v1/exercisewithjavaassess/javaassessing/",
type: "post",
data: data,
contentType: "application/json; charset=utf-8",
datatype: "json",
xhrFields: {withCredentials: true},
success: function(data) {
// alert("success");
//alert (data.data);
//reset(true);
if (data.data == "Empty") {
alert("Please enter a code to assess!")
}
else {
alert(data.data)
//eval(data.data );
}
},
error:function(data) {
alert("There is an error while submit");
}
});
}