Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you asking why am I getting the error: </p> <blockquote> <p>XMLHttpRequest cannot load localhost/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:8080' is therefore not allowed access. </p> </blockquote> <p>If so then what you need on your localhost server (assuming that is also Node) is a header set on the response from <code>localhost</code> to allow the Origin of <code>localhost:8080</code> to access this resource like this:</p> <pre><code>res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080'); </code></pre> <p>Or perhaps you are actually trying to request from the same server but forgot that 8080 is your test server: if so then in your test you should list your URL as </p> <pre><code>$.ajax("http://localhost:8080", { //.... </code></pre> <p>or to repeat the current origin: </p> <pre><code>$.ajax( window.location.origin,{ // .... </code></pre> <p>Your last alternative to avoiding this (if you can't set the Origin policies on the response) is to use a <code>jsonp</code> service which is less strict but also less featured, but that's not appropriate for your task so I won't go into that. </p> <p>Either way once you get past the Origin policy you'll have other hurdles as @zeroflagL mentions. Here's a method that might suit you: <a href="https://stackoverflow.com/questions/6393249/how-to-handle-cross-domain-iframe-file-upload-json-response">How to handle cross domain iframe file upload json response?</a></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. This table or related slice is empty.
    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