title: jquery ajax trouble with returning a responce from my success function
body: <p>I am developing a react app, so i have a build in webpack. This is the part of my core related to the problem</p>
  
  <pre><code>import $ from 'jquery'
  
  let ajax = (function () {
      const baseUrl = 'http://localhost:8080';
      let request = {
          get: (url, data) =&gt; {
              let settings = adjustSettings('GET', url, data);
              return $.ajax(settings)
          },
          put: (url, data) =&gt; {
              //TODO
          },
          post: (url, data) =&gt; {
              let settings = adjustSettings('POST', url, data);
              return $.ajax(settings);
          },
          delete: () =&gt; {
          }
      };
  
      function adjustSettings(method, url, data) {
          let settings = {
              method: method,
              url: baseUrl + url,
              data: JSON.stringify(data) || null,
              crossDomain: true,
              contentType: "application/json",
              success: (response, textStatus, xhr) =&gt; {
                  console.log(xhr);
                  let obj = {
                      response: response,
                      xhr: xhr
                  };
                  return obj;
              },
              error: (error) =&gt; {
                  return error;
              }
          };
          return settings;
      }
  
      return {request: request}
  })();
  export default ajax;
  </code></pre>
  
  <p>I the other file i am importing the ajax</p>
  
  <pre><code>import ajax from '../confing/ajax'
  ajax.request.post("/user/register", data).then((obj) =&gt; {
      console.log(obj);
  })
  </code></pre>
  
  <p>Now the ajax is beeing send to my backend and it works as intended, but when my <code>succes</code> function returns <code>obj</code> I dont seem to get any data inside my <code>.then((obj)</code> , by if try to <code>console.log(obj)</code>  inside the <code>success</code> function it works the data is there, so tl;dr; I seem to not be able to return the obj correctly from my <code>success</code>function. Any thoughts?</p>