title: how to solve cross domain in ajax
body: <p>I want to solve my AJAX cross domain problem. This is the error message I receive in Chrome:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load http://'myaddress'/TEST/user/login/testuserid . Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers. </p>
  </blockquote>
  
  <p>this is my source code</p>
  
  <pre><code>$.ajax({
      crossDomain : true,
      dataType : "json",
      url: fullUrl,
      method: method,
      headers:headers,
      data: body,
      success: function(data, state, res){
          if (data == null)
              data = '';
  
          console.log( '[[[[[[[[SUCCESS!!]]]]]]]   url: ' + url + ',   state:' + state + ',   data : ' + JSON.stringify( data ) );
          callback(data, state, res);
      },
      error: function(data, state){
          if ( data == null )
              data = '';
  
          console.log( '[[[[[[[[[ERROR!!]]]]]]]]]   url: ' + url + ', s  tate:' + state + ',   data : ' + JSON.stringify( data ) );
          callback(data, state, null);
      }
  });
  </code></pre>
  
  <p>Servlet code for cross Domain</p>
  
  <pre><code>httpRes.setHeader("Access-Control-Allow-Origin", "*");
  httpRes.setHeader("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE");
  httpRes.setHeader("Access-Control-Allow-Headers", "*"); 
  </code></pre>