title: Converting jQuery Request to Axios
body: <p>I have an app that was written in jQuery. I'm trying to modernize it. As part of that, I'm trying to convert a jQuery request to Axios. My jQuery request looks like this:</p>
  
  <pre><code>var myUrl = '[someUrl]';
  var myData = {
    firstName: 'Joe',
    lastName: 'Smith'
  };
  
  $.ajax({
    type: 'POST', url: myUrl, cache: 'false',
    contentType:'application/json',
    headers: {
      'Content-Type': 'application/json',
      'key': '12345'
    },
    data: JSON.stringify(myData),
    success: onSearchSuccess,
    error: onSearchFailure,
    complete: onSearchComplete
  }); 
  </code></pre>
  
  <p>Now, with my modern code, I have the following:</p>
  
  <pre><code>var myUrl = '[someUrl]';
  var myData = {
    firstName: 'Joe',
    lastName: 'Smith'
  };
  axios.post(myUrl, myData)
    .then(function (response) {
      alert('yeah!');
      console.log(response);
    })
    .catch(function (error) {
      alert('oops');
      console.log(error);
    })
  ;
  </code></pre>
  
  <p>I'm not sure how to pass in the headers or if I need to stringify <code>myData</code>. Can someone please point me in the right direction? </p>