title: Use IBM watson API with jquery's $.ajax
body: <p>I'm looking at the documentation for the watson API ( <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/qaapi/#apiRef" rel="nofollow">http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/qaapi/#apiRef</a> ) but there isn't a clear way regarding how to use the API with client-side js. I'd like to use jquery's $.AJAX function.</p>
  
  <p>How do I authenticate my account with the API using jquery and the send it a question? Once I get the json form the API, I can parse that, but how do I send it?</p>
  
  <p>Here is how I'd think about doing this, but I don't know where I get the authentication information from BlueMix and then to where I send the request to get the JSON.</p>
  
  <pre><code>var questionJSON = {
      'question': {
          'evidenceRequest': {
              'items' : 1
          },
          'questionText': question
       }
  };
  $.ajax({    
      url: '' // url,
      dataType: 'json',
      method: 'PUT',
      beforeSend: function(xhr){
          //xhr.setRequestHeader('Authorization', 'Basic '+btoa(accessToken+':'));
      },
      success: function(answerJSON){
          // parse answerJSON
      }
  });
  </code></pre>