Fetching JSON data using JS from a third party
<p>I'm trying to use a certain service to check for proxies. They have a simple API from which they return JSON. I'd like to get this JSON on my server.</p>

<p>No matter what I do, I either get a CORS request problem or a <code>SyntaxError: missing ; before statement</code> message.</p>

<p>Here's my code:</p>

<pre><code>&lt;h1&gt;Test Page&lt;/h1&gt;
&lt;a href="#" onclick="checkProxy()"&gt;Test Button&lt;/a&gt;


&lt;script&gt;
function checkProxy() {
  console.log("Checking...");
  $.ajax({
    url: 'http://api.ip2proxy.com/?ip=105.159.246.30&amp;key=demo',
    dataType: 'jsonp',
    success: function(data){
      console.log(data);
    }
  });
}
</code></pre>

<p>Clicking my 'button' calls the funtion, which returns the aforementioned syntax error. Changing the datatype to JSON gives me a CORS error.</p>

<p>The strange thing is, when I use a different URL -- example that I found in another StackOverflow thread: <code>http://www.locationbox.com.tr/locationbox/services?Key=3430000202000191008400080609030X20201090060050260003069&amp;Cmd=IlList</code> -- it logs the data just fine. </p>