Sari la conținutul principal

error using javascript GeoTab api

jeljeljel-1628
Poster original

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?

Alăturați-vă conversației

Trebuie să fii autentificat pentru a răspunde la această postare și pentru a participa la discuțiile comunității Geotab.

Cele mai bune răspunsuri

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 Răspunde

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' }); });

 

Mai aveți întrebări?