Fixed bug where ajax post handlers were being invoked when there is no ajax request