a different way of handling callbacks for ajax