Cross domain jQuery AJAX post JSON data
<p>In my node.js, express.js application I am trying to post json data to <a href="http://localhost:3000/api/delivered" rel="nofollow">http://localhost:3000/api/delivered</a>.
The HTML file-</p>

<pre><code>&lt;html&gt;
&lt;body&gt;
&lt;input type="submit" value="submit" id="delivered"/&gt;
&lt;/body&gt;

&lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" &lt;/script&gt;
&lt;script type="text/javascript"&gt;

$('#delivered').on('click', function () {
        var id = {"_id": "123"};

        $.ajax({
            type: 'POST',
            url: 'http://localhost:3000/api/delivered',
            contentType: 'application/json',
            data : JSON.stringify(id),
            dataType: "json",
            success: function () {
                console.log('Delivered');
            },
            error: function () {
                alert('Error occured while entering');
            }
        });

    });
</code></pre>

<p>
</p>

<p>I am getting the error-</p>

<blockquote>
  <p>XMLHttpRequest cannot load <a href="http://localhost:3000/api/delivered" rel="nofollow">http://localhost:3000/api/delivered</a>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.</p>
</blockquote>