title: Can access remote json component through browser, but not programmatically through $.getJSON()
body: <p>I've been battling for 3 days trying to solve this and have 'google overload' - would love some help please.</p>
  <p>We have a Jenkins build server located on <code>http://jenkinsBuild.mycompany.com:8080</code> so if I enter this url into a browser...</p>
  <p><code>http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?tree=result</code></p>
  <p>... the browser page returns displaying...</p>
  <p><code>{&quot;result&quot;:&quot;SUCCESS&quot;}</code></p>
  <p>Now, according to the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API" rel="nofollow noreferrer">Jenkins Wiki</a>, &quot;Jenkins provides machine-consumable remote access API to its functionalities&quot; supporting json and jsonp through a REST API, which I believe should circumvent any <em>same origin policy</em> issues.</p>
  <p>I am attempting (using the latest Chrome browser) to get that same json component <code>{&quot;result&quot;:&quot;SUCCESS&quot;}</code>.</p>
  <p>I am using HTML/javascript with a <code>$.getJSON()</code> call as described below. The HTML file currently resides on my local machine, but will probably eventually live on a wiki. Console outputs for the three urls are listed after the code.</p>
  <p>How do I get the same json result I get by entering the url directly into the browser? Thanks for your help.</p>
  <pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
  &lt;html&gt;&lt;head&gt;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
  
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
  $(document).ready(function(){
      var url1 = &quot;http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?tree=result&quot;;
      var url2 = &quot;http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?tree=result&amp;callback=?&quot;;
      var url3 = &quot;http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?callback=?&amp;tree=result&quot;;
  
      $('button').click(function(){
          $.getJSON(url1, function(json) {
              $(&quot;#reply&quot;).append(&quot;got callback: &quot; + json);    
          });
      });
  });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button&gt;Get Jenkins&lt;/button&gt;&lt;br /&gt;
  
  &lt;div id=&quot;reply&quot;&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>CONSOLE OUTPUT FOR THE THREE URL's...</p>
  <blockquote>
  <p><code>url1 -&gt; XMLHttpRequest cannot load <a href="http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?tree=result" rel="nofollow noreferrer">http://jenkinsBuild.mycompany.com:8080/view/my_view/job/build_me/123/api/json?tree=result</a>. Origin null is not allowed by Access-Control-Allow-Origin.</code></p>
  <p><code>url2 -&gt; Uncaught SyntaxError: Unexpected token : json:1</code></p>
  <p><code>url3 -&gt; Uncaught SyntaxError: Unexpected token : json:1</code></p>
  </blockquote>