SOME TIMES there is no X-Requested-With header, sometimes there is.
I checked in firebug and found that, don\'t know why.
So when I use requ
The reason I got this was because I was taking an element with my AJAX event handler attached, cloning it and then adding the new element to my document. For some reason this meant that the event attached to the new element would not treat it as a normal ajax request (Accept:text/html instead of application/json, no X-Requested-With etc.)
To fix this all I did was change the event to jQuery's new equivalent of live() (unsure what they call it now). So from:
$('a.basket-add').click(function() { /* etc */ });
To:
$(document).on('click', '.basket-add', function() { /* etc */ });