Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- let baseServiceUrl = 'https://judgetests.firebaseio.com/schedule/';
- let currentId = "depot";
- let name = '';
- function depart() {
- $('#depart').prop('disabled', true);
- $.get(baseServiceUrl + currentId + '.json')
- .then(function (data) {
- name = data.name;
- currentId = data.next;
- $('#info').find('span').text(`Next stop ${data.name}`);
- $('#arrive').prop('disabled', false)
- })
- }
- function arrive() {
- $('#depart').prop('disabled', false);
- $('#arrive').prop('disabled', true);
- $('#info').find('span').text(`Arriving at ${name}`);
- }
- return {
- depart,
- arrive
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement