Even I am not too sure, but do check this comment. It just appeared to me that it's the right way.

http://davidwalsh.name/detect-ajax#comment-10768