1 model=window.model||{};
3 function load(path,onload,onerror){
4 onerror = onerror||function(){};
5 var xhr = new XMLHttpRequest();
6 xhr.onload = function(){
7 if( this.status != 200 ){
8 onerror( this.responseText, this.status );
10 onload( this.responseText );
13 function errorHandler( e ){
14 onerror( (e||e.error).stack );
16 xhr.onerror = errorHandler;
18 xhr.open("GET",path,true);
28 function loadClasses(){
32 "http://home.gibm.ch/interfaces/133/klassen.php?beruf_id=" + jobId,
35 list: JSON.parse( res ),
36 loadCalendar: loadCalendar
43 function loadCalendar(){
45 model.calendar = null;
47 "http://home.gibm.ch/interfaces/133/tafel.php?klasse_id=" + classId,
50 events: JSON.parse( res )
58 load("http://home.gibm.ch/interfaces/133/berufe.php", function( res ){
60 list: JSON.parse( res ),
61 loadClasses: loadClasses