Made pages output JSON instead of rendering a template if request is by AJAX