Adding in full MTA api.
* Added in support for station search, route specific search, and several time limiting functions Added in functional backend in flask * starts flask app * starts MTA app on another thread * serves basic webpage which pull subway data from flask backend on button press.
This commit is contained in:
33
templates/static/js/DataRequests.js
Normal file
33
templates/static/js/DataRequests.js
Normal file
@@ -0,0 +1,33 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
function clearCanvas() {
|
||||
var canvas = document.getElementById("inputCanvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
function getData() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
//the url where you want to sent the userName and password to
|
||||
url: '/mta_data',
|
||||
contentType: "application/json",
|
||||
dataType: "json",
|
||||
async: true,
|
||||
//json object to sent to the authentication url
|
||||
data: JSON.stringify({"test_dict":"test_value"}, null, '\t'),
|
||||
|
||||
success: function (data, text) {
|
||||
$("#result").text(JSON.stringify(data));
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
alert(request.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#test_button").click(function () {
|
||||
getData();
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user