title: Execute javascript function on ajax error
body: <p>I use the following ajax function to call a webservice, if I get an error I would like it to trigger a javascript function userCreate()</p>
  
  <pre><code>$.ajax({
      type:"POST",
      beforeSend: function (request) {
          request.setRequestHeader("X-DreamFactory-Application-Name", "snapcentral");
          request.setRequestHeader("X-DreamFactory-Session-Token", sessID.dream);
      },
      url: url,
      data: '{"username":"' + userStats.loginID + '","lithid":"' + userStats.userID + '"}',
      success: function(data) {
          dbData = data;
          console.log('createUsers Executed sucessfully');
      },
      error: function (request, status, error) {
          console.log("createUser: " + request.responseText);
          createUser();
      }
  });
  </code></pre>
  
  <p>Everything works as expected apart from the "error" section not triggering the createUser() function. What am I doing fundamentally wrong and how do I get the query to execute a function on error.</p>
  
  <p>The function I have written for createUser works if I call standalone..</p>
  
  <p>Advise and/or direction would be most welcome - thanks.</p>