IonicCourseCode1

declare var $:any;




function onClickButton(){

        let url = 'http://transportapi.com/v3/uk/train/station/exc/live.json?'

            +'app_id=*****&'

            +'app_key=******************';
//get your own app_id and app_key from http://transportapi.com/v3/uk

        $.get(url).then(

            (data:any)=>{

                var x = data;

                let element = document.getElementById("statusText");

                if(element != null){

                    element.innerHTML = '<ul>';

    

                    for(var i=0;i<data.departures.all.length;++i){

                        let itm = data.departures.all[i];

                        let itmString = '<li>Plat ' + itm.platform

                            + ' Time ' + itm.expected_departure_time

                            + ' To ' + itm.destination_name + '</li>';

                        element.innerHTML += itmString;

                    }

                    element.innerHTML += '<ul>';

                }

                

            }

        );  

}

//(see c:\users\IonicNinja\Documents\TestTrainTimetable\index.ts)
Website by WNW Digital