I recently came across a funny bug where I was executing an AJAX method and the response was empty.

I check the server side and I know that my particular query is returning a result, but thanks to Firebug I can see it's failing in the browser.

So there was something definitely amiss.

UK EVENTAttend ffconf.org 2024

The conference for people who are passionate about the web. 8 amazing speakers with real human interaction and content you can't just read in a blog post or watch on a tiktok!

In particular, I was returning my result as a JSON object which should have looked like this:

{message: "Order Filled"}

However, Firebug was throwing the following error (within the jQuery library - but I had the same problem when I hadn't used a library):

syntax error data =

The problem is down to the size of the response. It's something like apache is compressing it to nothing. Not very technical I realise - but the solution is to pad the response.

I fixed it by placing a '\n' before the JSON - since it's legal syntax it doesn't cause a problem, and it means the response is read in the browser.

All was well again in the land of AJAX & Remy.