rewrite templates to call one template for ajax and pure html