implementing client side ajax error handeling