Edit this page

up.radio [up-poll]
HTML selector

Elements with an [up-poll] attribute are reloaded from the server periodically.

Polling

Example

This fragment #score will be reloaded every 30 seconds:

<div id="score" up-poll> <!-- mark: score -->
  Score: 1400
</div>

Trigger

[up-interval]
optional

The reload interval in milliseconds.

Defaults to up.radio.config.pollInterval, which defaults to 30 seconds.

[up-if-layer='front']
optional

Controls polling while the fragment's layer is covered by an overlay.

When set to 'front', polling will pause while the fragment's layer is covered by an overlay. When the fragment's layer is uncovered, polling will resume.

When set to 'any', polling will continue on background layers.

Request

[up-href]
optional

The URL from which to reload the fragment.

Defaults to the URL this fragment was originally loaded from.

[up-method='get']
optional

The HTTP method used to reload the fragment.

[up-headers]
optional

A relaxed JSON object with additional request headers.

[up-params]
optional

A relaxed JSON object with additional parameters that should be sent as the request's query string or payload.

When making a GET request to a URL with a query string, the given { params } will be added to the query parameters.

[up-fail]
optional

How to handle failed server responses.

By default, polling will skip server responses with an error code, even when the response contains a matching fragment. After the configured interval, the server will be polled again.

Set [up-fail=false] to render any response that contains a matching fragment, even with a 4xx or 5xx status code.

Client state

[up-keep-data]
optional

Whether to preserve the polling fragment's data object through reloads.

Loading state

[up-disable]
optional

Disables form controls while the link is loading.

[up-placeholder]
optional

A placeholder to show in the targeted fragment while new content is loading.

Existing children of the targeted fragment will be hidden during the request. When the request ends for any reason, all changes will be reverted.

You can either pass a HTML string or refer to a template, optionally with variables.

If this link opens a new overlay, the placeholder will be shown temporary overlay with the same visual style and open animation.

[up-preview]
optional

The name of a preview that temporarily changes the page while new content is loading.

The preview changes will be reverted automatically when the request ends for any reason.

[up-feedback='true']
optional

Whether to set feedback classes while loading content.