title: An ajax request fails and I cannot figure out why?
body: <p>for some very weird reason my ajax request keeps returning as an error, however the data does get added to the database. In the console it just shows a whole bunch of stuff in terms of when I log the error and I can't understand where exactly it is coming from. All the php/html/naming is correct as this used to work, however I don't understand why this happens.</p>
  
  <p>Code:</p>
  
  <pre><code>function doShorten(event)
   {
  event.preventDefault();
  
  var form_data = {
      long_url : $("[name='long_url']").val()
  };
  
  $.ajax({
      type: "POST",
      url: "url/short_ajax",
      data: form_data,
      dataType: "json",
      timeout: 10000,
  
      beforeSend: function() {
          console.log("About to send");
      },
  
      complete: function() {
          console.log("Complete", this.url);
      },
  
      success: function(data){
          console.log("Success", this.url);
          $('#shorty').addClass('shorty').html("Short URL: "+data);
      },
  
      error: function(error) {
          console.log("Error", this.url, error);
      }
  
  });
  }
  </code></pre>
  
  <p>Please help!</p>
  
  <pre><code>Stuff I get in the console:
      abort: function (a){a=a||"abort",p&amp;&amp;p.abort(a),w(0,a);return this}
  always: function (){i.done.apply(i,arguments).fail.apply(i,arguments);return this}
  complete: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  done: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  error: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  fail: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  getAllResponseHeaders: function (){return s===2?n:null}
  getResponseHeader: function (a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c}
  isRejected: function (){return!!i}
  isResolved: function (){return!!i}
  overrideMimeType: function (a){s||(d.mimeType=a);return this}
  pipe: function (a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&amp;&amp;f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()}
  progress: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  promise: function (a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}
  readyState: 4
  responseText: "http://localhost/u/pRam"
  setRequestHeader: function (a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this}
  state: function (){return e}
  status: 200
  statusCode: function (a){if(a){var b;if(s&lt;2)for(b in a)j[b]=[j[b],a[b]];else    b=a[v.status],v.then(b,b)}return this}
  statusText: "OK"
  success: function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this}
  then: function (a,b,c){i.done(a).fail(b).progress(c);return this}
  __proto__: Object
  </code></pre>