title: Origin url is not allowed by Access-Control-Allow-Origin
body: <p>I know there are many questions already regarding this error. But, I'm still not able to get this working even after setting the header                   </p>
  
  <pre><code>         "Access-Control-Allow-Origin" : "*"
  </code></pre>
  
  <p>on my server side. </p>
  
  <p>Here is my spring mvc controller method:</p>
  
  <pre><code>    @RequestMapping(method=RequestMethod.GET, value="dummy/{num}")
      @ResponseBody
      public ResponseEntity&lt;Result&gt; dummy(@PathVariable String num)
      {
          int n = Integer.parseInt(num);
          final Result result = new Result();
          result.setAddition(n+20);
          result.setMultiplication(n*20);
          result.setSubtraction(n-20);
          HttpHeaders headers = new HttpHeaders();
          headers.add("Access-Control-Allow-Origin", "*");
          ResponseEntity&lt;Result&gt; ent = new ResponseEntity&lt;Result&gt;(result,headers,HttpStatus.CREATED);
          return ent;
      }
  </code></pre>
  
  <p>And here is my AJAX call from Jquery</p>
  
  <pre><code>$.ajax({
      url: "http://localhost:8010/Probe_Rest_Service/test/dummy/9",
      type: "get",
      crossDomain: true,
      dataType: 'json',
      headers: { 
      "Content-type" : "application/json"
      },
  
      success: function(data){
  
          console.log("It worked!");
          alert(data);
      },
  
      error: function(){
          // enable the inputs
          alert("error");
      }
  });
  </code></pre>
  
  <p>I tried calling my REST api from dev-http client for chrome and it works fine (the response header has Access-Control-Allow-Origin:* set) . But, when i call it from my html file, i get the error. </p>
  
  <p>I use JBoss for my rest api and tomcat for hosting my client webpage</p>