| | |
| | | /* |
| | | |
| | | Beispiel aus Spot fuer den Post eines Coordinates-Objektes |
| | | |
| | | var coord = new Coordinates( |
| | | c.latitude, |
| | | c.longitude, |
| | | self.nummer(c.altitude), |
| | | self.nummer(c.accuracy), |
| | | self.nummer(c.altitudeAccuracy), |
| | | self.nummer(c.heading), |
| | | self.nummer(c.speed)); |
| | | var cObj = self.serialisieren(coord); |
| | | |
| | | |
| | | $.ajax({ |
| | | url: '../rpc?c=de.uhilger.spot.api.NutzerApi&m=ortSpeichern', |
| | | data: { |
| | | p: cObj |
| | | }, |
| | | type: "POST", |
| | | dataType : "html", |
| | | //success: function( resp ) { |
| | | //$('#fehler').html('Antwort: ' + resp); |
| | | //}, |
| | | error: function( xhr, status, errorThrown ) { |
| | | $('#fehler').html("Error: " + errorThrown + " Status: " + status); |
| | | }, |
| | | complete: function( xhr, status ) { |
| | | //alert( "The request is complete!" ); |
| | | } |
| | | }); |
| | | usw. |
| | | |
| | | |
| | | function Coordinates(la, lo, al, ac, aa, hd, sp) { |
| | | this.latitude = la; |
| | | this.longitude = lo; |
| | | this.altitude = al; |
| | | this.accuracy = ac; |
| | | this.altitudeAccuracy = aa; |
| | | this.heading = hd; |
| | | this.speed = sp; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | */ |
| | | |
| | | function um_init() { |
| | | $('.user-save-btn').click(um_user_save); |
| | | } |
| | | |
| | | function um_user_save() { |
| | | alert('user-save'); |
| | | var user = um_user_form_lesen(); |
| | | var kww = $('#kennwortw').val(); |
| | | if(user.pw != kww) { |
| | | alert('Kennworte stimmen nicht ueberein.'); |
| | | } else { |
| | | alert('user-save ' + user.id); |
| | | um_apicall(self.serialisieren(user)); |
| | | } |
| | | } |
| | | |
| | | function um_apicall(obj) { |
| | | var c = 'de.uhilger.um.api.UserMgr'; |
| | | var m = 'createUser'; |
| | | var u = '../api?c=' + c + '&m=' + m; |
| | | $.ajax({ |
| | | url: u, |
| | | data: { |
| | | p: obj |
| | | }, |
| | | type: "POST", |
| | | dataType : "html", |
| | | //success: function( resp ) { |
| | | //$('#fehler').html('Antwort: ' + resp); |
| | | //}, |
| | | error: function( xhr, status, errorThrown ) { |
| | | $('#fehler').html("Error: " + errorThrown + " Status: " + status); |
| | | }, |
| | | complete: function( xhr, status ) { |
| | | //alert( "The request is complete!" ); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function um_user_form_lesen() { |
| | | var userId = $('#anmeldename').val(); |
| | | var kw = $('#kennwort').val(); |
| | | var user = new User(userId, kw, '-', '-', '-'); |
| | | return user; |
| | | } |
| | | |
| | | function serialisieren(obj) { |
| | | return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}'; |
| | | }; |
| | | |
| | | function User(i, p, fn, ln, em) { |
| | | this.id = i; |
| | | this.pw = p; |
| | | this.firstName = fn; |
| | | this.lastName = ln; |
| | | this.email = em; |
| | | } |