Ga naar hoofdinhoud

error using javascript GeoTab api

jeljeljel-1628
Oorspronkelijke plaatser

I am having trouble getting the GeoTab javascript API to function. I am loading the javascript found at...

 

https://cdn.jsdelivr.net/npm/mg-api-js

 

The code I am trying to run is simply...

$(document).ready(function() { var api = GeotabApi({ credentials: { database: 'mydb', userName: 'myusername', password: 'mypassword' }, path: 'my.geotab.com' }); });

 

 

The error I get is...

"jQuery.Deferred exception: Cannot call a class as a function", "TypeError: Cannot call a class as a function at _classCallCheck (https://cdn.jsdelivr.net/npm/mg-api-js:598:99) at GeotabApi (https://cdn.jsdelivr.net/npm/mg-api-js:627:5) at HTMLDocument.<anonymous> (https://fiddle.jshell.net/_display/?editor_console=true:113:13) at mightThrow (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js:3557:29) at process (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js:3625:12)", undefined "Script error."

I have a sample that shows the error at this location...

 

https://jsfiddle.net/jeljeljel/6o9wdehs/3/

 

What am I doing wrong here?

Deelnemen aan het gesprek

Je moet ingelogd zijn om op dit bericht te reageren en deel te nemen aan de discussies in de Geotab Community.

Populaire antwoorden

jpaz-1560
Geotabber

Hi @jeljeljel-1628​ you just new to include the new token before the GeotabApi instantiation.

 

$(document).ready(function() { var api = new GeotabApi({ credentials: { database: 'mydb', userName: 'myusername', password: 'mypassword' }, path: 'my.geotab.com' }); });

 

1 antwoord

jpaz-1560
Geotabber

Hi @jeljeljel-1628​ you just new to include the new token before the GeotabApi instantiation.

 

$(document).ready(function() { var api = new GeotabApi({ credentials: { database: 'mydb', userName: 'myusername', password: 'mypassword' }, path: 'my.geotab.com' }); });

 

Heeft u nog vragen?