<pre class="highlight javascript"><code>{% highlight 'javascript' %}var coreapi = window.coreapi

// Initialize a client & load the schema document
var client = new coreapi.Client()
var document = null
client.get("{{ schema_url }}").then(function(result) {
    document = result
})

// Interact with the API endpoint
var action = [{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"]
{% if link.fields %}var params = {
{% for field in link.fields %}    {{ field.name }}: ...{% if not loop.last %},{% endif %}
{% endfor %}}
{% endif %}client.action(document, action, params=params).then(function(result) {
    // Return value is in 'result'
}){% endhighlight %}</code></pre>
