-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterfaceTester.html
43 lines (35 loc) · 1.14 KB
/
interfaceTester.html
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
38
39
40
41
42
43
<!doctype html>
<html>
<head>
<title>Python Interface Tester</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
</head>
<body>
<button id="mybutton" type="button" onclick="interfaceTest()" disabled>Run InterfaceTest</button>
<p />
<span id="solution"></span>
<script>
// add your datafile and interface to test here
dataFile = "data/mydata.geojson";
interfaceFile = "interface/tsp_interface.py";
$.when($.getJSON(dataFile)).done(function(defaultMarkers) {
$('#mybutton').removeAttr('disabled');
useThisInputData = JSON.stringify(defaultMarkers);
document.getElementById('solution').innerHTML = "Test input: " + useThisInputData;
});
function interfaceTest(){
$.ajax({
type: 'POST',
url: interfaceFile, // this is the interface to test.
data: {useTheseMarkers:useThisInputData},
success: function(answerText) {
document.getElementById('solution').innerHTML = "Test output: " + answerText;
},
error: function(){
document.getElementById('solution').innerHTML = "Failure";
}
});
};
</script>
</body>
</html>