Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var routes = "";
- var urlEnd = "50017";
- var routesURL = 'http://orbis.stanford.edu/api/sites/' + urlEnd
- function possibleRoutes(){
- document.write("<center><b> Welcome to the Londinium Way!<br>");
- opt1 = routes[0];
- opt2 = routes[1];
- opt3 = routes[2];
- name1 = opt1[0];
- document.write("Your options are:");
- document.write("<button onclick=getRoutes(opt1[1]) id='button1'></button>");
- document.getElementById('button1').innerHTML=opt1[0];
- document.write("<button onclick=getRoutes(opt2[1]) id='button2'></button>");
- document.getElementById('button2').innerHTML=opt2[0];
- document.write("<button onclick=getRoutes(opt3[1]) id='button3'></button>");
- document.getElementById('button3').innerHTML=opt3[0];
- }
- function getRoutes(){
- $(function getRoutes(routesURL) {
- $.ajax({
- type: 'GET',
- dataType: 'jsonp',
- crossDomain: true,
- url: routesURL,
- success: function(data) {
- console.log('success', data);
- var route = JSON.parse(data)
- routes = route.routes;
- possibleRoutes();
- }
- });
- });
- }
Add Comment
Please, Sign In to add comment