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(){
31 model.calendar = null;
33 "http://home.gibm.ch/interfaces/133/klassen.php?beruf_id=" + jobId,
36 list: JSON.parse( res ),
37 loadCalendar: loadCalendar
44 function loadCalendar(){
46 model.calendar = null;
48 "http://home.gibm.ch/interfaces/133/tafel.php?klasse_id=" + classId,
51 events: JSON.parse( res )
59 load("http://home.gibm.ch/interfaces/133/berufe.php", function( res ){
61 list: JSON.parse( res ),
62 loadClasses: loadClasses