Refactor ajax error url reporting