2

I have included the required files in the head as it says in the docs

<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'></script>
<script src='https://cdn1.kongregate.com/javascripts/kongregate_api.js'></script>

And then right above my scripts i included the script that supposed to define the variable

<script>
    kongregateAPI.loadAPI(function(){
        window.kongregate = kongregateAPI.getAPI();
    });
</script>

But in the console I am still getting this error Uncaught ReferenceError: kongregate is not defined

Hunter Turner
  • 6,804
  • 11
  • 41
  • 56

1 Answers1

0

You said:

And then right above my scripts i included

Does it mean that your code looks like this?

<script>
    kongregateAPI.loadAPI(function(){
        window.kongregate = kongregateAPI.getAPI();
    });
</script>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'></script>
<script src='https://cdn1.kongregate.com/javascripts/kongregate_api.js'></script>

If so, you should call kongregateAPI functions after you loaded api js file:

<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'></script>
<script src='https://cdn1.kongregate.com/javascripts/kongregate_api.js'></script>
<script>
    kongregateAPI.loadAPI(function(){
        window.kongregate = kongregateAPI.getAPI();
    });
</script>

I've tried it, everything works fine.

shaggy
  • 1,708
  • 2
  • 15
  • 17