 <p>Try like below,</p> <pre><code>//Note the quotes moved -----------------v $.getJSON('http://api.websiteexample.com/' + apikey); </code></pre> <p>When you have it inside quotes.. It would be considered as a <code>string</code>. You need to put it outside quotes for it to know it is an variable.</p>