Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://........
<p>I am trying to communicate with an enterprise application from an web application mainly via javascript using ajax. I tried a lot to solve this issue but not succeeded. I saw several online httppost tool there I am able to see the response text but it is not happening from my end. Each time I am receiving an message like <strong>"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://url" rel="nofollow">http://url</a>. (Reason: CORS header 'Access-Control-Allow-Origin' missing)."</strong></p>

<p>My code:</p>

<pre><code>var url = "use_url";
var method = "POST";

var regid = "null";
var UNAME = "abcd089";
var PASSWORD = "abcd007*";
var forLogin = "10 112 " +UNAME+ " " + PASSWORD + " " + regid + " 01";
var async = true;

var request = new XMLHttpRequest();

request.open('POST', url, async);
request.onload = function(){
            //HTTP response
            //if(request.readyState === 4 &amp;&amp; request.status === 200){
            var status = request.status;
            var statusData = request.responseText;              

            console.log(status);
            console.log(statusData);
            console.log(request);

        //}
};

request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
request.setRequestHeader("Cache-Control", "no-cache");

request.send(forLogin);
</code></pre>

<p>I am looking for a solution to get response text. I saw online some solutions but they all are talking about setting response header, but some online httppost sites are working fine on data and producing response text. I am looking solution in javascript.</p>