본문으로 바로가기

error using javascript GeoTab api

jeljeljel-1628
원글 작성자

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?

대화에 참여하기

이 게시물에 답글을 달고 Geotab 커뮤니티 토론에 참여하려면 로그인해야 합니다.

최고 답변

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개

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

 

여전히 궁금한 점이 있으신가요?