title: Ajax Response 200 ok, but shows failed to load response data
body: <p>I am making an ajax call to a backend rest api, the api is returning fine. If I console.log() the success data and error data, it gives "resource logged in", 200 ok on the console but when I view it in the network tab response for that auth/login route, it shows "Failed to load the response data". And this happens sometimes only and not always. Why?
  Here's the snippet of my ajax call.</p>
  
  <pre><code>ajax
      .post('auth/login', {
            data: {
                oauth_provider: 'google',
                oauth_token: (isToken ? authResult : authResult.access_token)
                },
            cache: false
            })
            .done(function(data) {
               console.log(data); // Resource Logged in
             })
             .error(function(err){
              console.log(err);
             })
  </code></pre>
  
  <p>Here's the content of my ajax.js</p>
  
  <pre><code>define(
    [
      'jquery',
      'util',
    ],
    function ($, util) {
      var ajax = {
        request: function (type, url, options) {
          if (url.indexOf('http') === -1) {
            url = util.url(url);
          }
  
          if (options === undefined) {
            options = {};
          }
  
          options.type = type
          options.url = url;
  
          return $.ajax(options);
        },
  
        get: function (url, options) {
          return ajax.request('GET', url, options);
        },
  
        post: function (url, options) {
          return ajax.request('POST', url, options);
        },
  
        put: function (url, options) {
          return ajax.request('PUT', url, options);
        },
  
        delete: function (url, options) {
          return ajax.request('DELETE', url, options);
        }
      };
  
      return ajax;
    }
  )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Xy12E.png"><img src="https://i.stack.imgur.com/Xy12E.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/LJ1ZW.png"><img src="https://i.stack.imgur.com/LJ1ZW.png" alt="enter image description here"></a></p>