title: How to send ajax get request to WooCommerce rest API in localhost?
body: <p>I am using the Woocommerce Rest API. I can send a get request using <strong>Postman</strong> to the live site that uses <code>https</code> but I am currently using xampp for localhost server and I cannot connect to my localhost server.</p>
  
  <p>But if I use <strong>OAuth 1.0</strong> in Postman and enter my woocommerce key and secret the URL becomes <br><code>http://localhost/mywebsite/wp-json/wc/v2/orders/12345?oauth_consumer_key=ck_my_key123&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1531881865&amp;oauth_nonce=CxWcdh&amp;oauth_version=1.0&amp;oauth_signature=fjfjosl12=</code></p>
  
  <p>The initial form of the URL before the request was <code>http://localhost/mywebsite/wp-json/wc/v2/orders/12345</code></p>
  
  <p>Now I want to send a jquery ajax getting the request to my localhost server with OAuth 1.0</p>
  
  <pre><code>  j('#getlatestorder').click(function() {
  
      debugger
  
      j.ajax({
  
        type: 'GET',
        url: 'http://localhost/mywebsite/wp-json/wc/v2/orders/12345?oauth_consumer_key=ck_my_key123&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1531881865&amp;oauth_nonce=CxWcdh&amp;oauth_version=1.0&amp;oauth_signature=fjfjosl12=',
        cache: false,
        data: {
          format: 'json'
        },
        success: function(data) {
          console.log('Order Received');
          console.log(data);
        },
        error: function(xhr,status,error) {
  
        },
        complete: function() {
        }
  
      });
  
    });
  </code></pre>
  
  <p>I am receiving a <code>401 (Unauthorized)</code> error for the code above but I can connect in Postman.</p>
  
  <p>Do you know if there is anything I can update with my jquery code? Any idea is appreciated. Thanks</p>