
        data: {count: count + 1},
        withCredentials: true,
    })
    .then(function(data) {
        count = parseInt(data.count)
    })
}
</code></pre>
<p>Calling the increment function <a href="https://en.wiktionary.org/wiki/upsert">upserts</a> an object <code>{count: 1}</code> to the <code>/api/tutorial/1</code> endpoint. This endpoint returns an object with the same <code>count</code> value that was sent to it. Notice that the <code>count</code> variable is only updated after the request complete