Controller
renderNothing()
Signature
Section titled “Signature”renderNothing() — returns void
Available in: controller
Category: Rendering Functions
Description
Section titled “Description”Instructs the controller to render an empty string when it’s finished processing the action.
This is very similar to calling cfabort with the advantage that any after filters you have set on the action will still be run.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
status | string | no | [runtime expression] | Force request to return with specific HTTP status code. |
Examples
Section titled “Examples”// 1. Render a blank response (useful for AJAX fire-and-forget actions)
renderNothing();
// 2. Render a blank response with a specific HTTP status code (e.g., 204 No Content)
renderNothing(status=204);
// 3. Use renderNothing() instead of cfabort so that after-filters still run
// In a controller action:
function markAsRead() {
post = model("Post").findByKey(params.key);
post.update(read=true);
// After-filters (e.g. logging) will still execute, unlike cfabort
renderNothing();
}