Edit this page

up.fragment up.reload([target], [options])
JavaScript function

Replaces the given element with a fresh copy fetched from the server.

By default, reloading is not considered a user navigation and e.g. will not update the browser location. You may change this with { navigate: true }.

Example

up.on('new-mail', function() { up.reload('.inbox') })

Controlling the URL that is reloaded

Unpoly remembers the URL from which a fragment was loaded, so you don't usually need to pass a URL when reloading.

To reload from another URL, pass a { url } option or set an [up-source] attribute on the element being reloaded or its ancestors.

Skipping updates when nothing changed

You may use the [up-time] attribute to avoid rendering unchanged HTML when reloading a fragment. See [up-time] for a detailed example.

Parameters

[target] stringorElementorjQuery optional

The element that should be reloaded.

If omitted, an element matching a selector in up.fragment.config.mainTargets will be reloaded.

[options] Object optional

See options for up.render().

[options.url] string optional

The URL from which to reload the fragment. This defaults to the URL from which the fragment was originally loaded.

[options.navigate=false] string optional

Whether the reloading constitutes a user navigation.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more