title: Call external URL from AJAX in jQuery
body: <p>I need to call a external URL (not in my development server) that returns JSON response. Doing some research I found <a href="https://stackoverflow.com/questions/4613310/how-to-call-external-url-in-jquery">this</a> and <a href="https://stackoverflow.com/questions/3873636/no-response-from-mediawiki-api-using-jquery">this</a> post and tried almost every, right now my code is this:</p>
  
  <pre><code>$("#query").on("keyup", function(e) {
      if (e.which !== 32) {
          var value = $(this).val();
          var noWhitespaceValue = value.replace(/\s+/g, '');
          var noWhitespaceCount = noWhitespaceValue.length;
  
          if (noWhitespaceCount % 3 === 0) {
              var request = $.ajax({
                  type: 'GET',
                  data: "text=" + $(this).val(),
                  url: "http://192.168.0.159:3000/products/search/all",
                  success: function(data) {
                      console.log(data);
                  },
                  error: function(jqXHR, textStatus, errorThrown) {
                      console.log(jqXHR, textStatus, errorThrown);
                      request.abort();
                  }
              });
          }
      }
  });
  </code></pre>
  
  <p>But it's not working, so what is the best way to achieve this?</p>