I'm making an ajax call to a different domain. My team member added the Access-Control-Allow-Origin header to http://localhost:3000 . 
$.ajax({
          type: 'GET',
          url: myurl,
          beforeSend: function(xhr) {
              xhr.setRequestHeader('Authorization', 'Bearer '+authorization);
          },
          crossDomain: true,
          // xhrFields: {
          //   withCredentials: true
          // },
          contentType: 'application/json',
          dataType: 'JSON',
          success: function (response) {
            if(time_one === 0){
              main_result = response;
              time_one++;
            }
            if(response.length==0){
              alert("NO Data; Try a valid search")
              $('.row3, #paging').hide();
              $('.loading-gif').show();
              $('#table').html('');
              myCallBack(main_result);
            }
            else{
              $('#table').html('')
              myCallBack(response);
            }
          },
          error: function(err) {
            $('.loading-gif').hide();
            $(".pageblocker").hide();
            alert('Error: '+JSON.stringify(err));
            myCallBack(main_result)
          }
      });
If I try this way, I'm getting 'Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.' I don't understand why I'm getting such type of error even after adding the ACAO header. 
And I also noticed another error if I add the 'withCredentials' attribute.
'Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.' I don't understand the difference between those two errors.
 
    