Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You will definitely run into some hurdles trying to make cross-origin requests. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript" rel="nofollow">That includes port-to-port</a>.</p> <p>The solutions also depend on the service and what features it supports.</p> <ul> <li><p><a href="https://en.wikipedia.org/wiki/JSONP" rel="nofollow">JSONP</a> (or, JSON with Padding)</p> <p>The service would need to accept a <code>callback</code> and output the JSON wrapped in a function call:</p> <pre><code>// http://...?callback=completeRequest completeRequest(["json", "data"]); </code></pre> <p>The parameter can be a different name than <code>callback</code>. But, you can instruct jQuery to use it by including a placeholder parameter (<code>...=?</code>):</p> <pre><code>$.getJSON(serviceAddress + "?callback=?") </code></pre> <p>This can also be used in any browser as it's requested as a <code>&lt;script src&gt;</code> and the JSON will be parsed as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#Literals" rel="nofollow">JavaScript literals</a>.</p></li> <li><p><a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS" rel="nofollow">CORS</a></p> <p>The service will need to support <a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Preflighted_requests" rel="nofollow">preflight, <code>OPTIONS</code> requests</a> and respond with <a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#The_HTTP_response_headers" rel="nofollow"><code>Access-Control-Allow-*</code> headers</a>.</p> <p>Also, while <a href="http://caniuse.com/#feat=cors" rel="nofollow">most current browsers support CORS</a>, this can be limited if you need to support older editions.</p></li> </ul> <p>Otherwise, you'll need to create a proxy destination in your application (<code>localhost:2771</code>) that makes the cross-origin request server-side to the service (<code>localhost:4143</code>).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload