When redirect is requested within ajax request, then "
#redirect#url_here" text is returned as ajax request result instead of "
header('Location: url_here')" being sent as usual.
This is done for ajax request caller to decide how redirect should be handled.
It works fine with debug mode turned off, but it breaks redirect, when debug mode is on resulting debugger report being printed after "#redirect#url_here" text.
Ready for testing.