title: Perform curl request in javascript?
body: <p>Is it possible to send a curl request in jQuery or javascript?</p>
  
  <p>Something like this: </p>
  
  <pre><code>curl \
  -H 'Authorization: Bearer 6Q************' \
  'https://api.wit.ai/message?v=20140826&amp;q='
  </code></pre>
  
  <p>So, in PHP on submission of a form, like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>$header = array('Authorization: Bearer 6Q************');
  $ch = curl_init("https://api.wit.ai/message?q=".urlEncode($_GET['input']));
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  $response = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>What I'm trying to do is perform this curl request, which returns json and then I plan on parsing it with jQuery's <code>$.get()</code> function.</p>