Search the Community
Showing results for tags 'AjaxEvent continuously firing'.
-
Hi I have the following Javascript added to get current location, and receive the Ajaxevent no problem, however the event keeps firing continuously, how is possible to control the firing of the event? regards UniSession.AddJS( 'navigator.geolocation.getCurrentPosition'+ '( '+ 'function(position)'+ '{ '+ ' ajaxRequest(navigateFrame.UnimHTMLFrame1, "_GeoLocation" ,' + ' ["lat=" + position.coords.latitude, ' + ' "lng=" + position.coords.longitude, ' + ' "acc=" + position.coords.accuracy, ' + ' "alt=" + position.coords.altitude, ' + ' "altacc=" + position.coords.altitudeAccuracy, ' + ' "head=" + position.coords.heading, ' + ' "ts=" + position.coords.timestamp ' + ' ]);' + '} '+ ', '+ 'function(error)'+ '{ '+ ' switch(error.code) '+ ' { '+ ' case 0: '+ // UnKown ' alert(error.message); '+ ' break; '+ ' case 1: '+ // Denied ' alert(error.message); '+ ' break; '+ ' case 2: '+ // UnAvailable ' alert(error.message); '+ ' break; '+ ' case 3: '+ // TimeOut ' alert(error.message); '+ ' break; '+ ' } '+ '} '+ ') ' ); procedure xxx.UnimHTMLFrame1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if SameText(EventName, 'loaded') then begin ............. end; end else if SameText(EventName, '_GeoLocation') then begin if (Params.Values['lat'] <> '') then begin Lat:= strToFloat(Params.Values['lat']); Long:= strToFloat(Params.Values['lng']); end; end; end;