Interface PjaxStatic

Index

Call signatures

Properties

Methods

Call signatures

(options?: PjaxSettings): JQueryXHR

Loads a URL with ajax, puts the response body inside a container, then pushState()'s the loaded URL. Works just like $.ajax in that it accepts a jQuery ajax settings object (with keys like url, type, data, etc).

Parameters

  • options?: PjaxSettings optional

    PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:

    • container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
    • push: a boolean indicates whether to pushState the URL. Default is true.
    • replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.

Returns

JQueryXHR

Properties

public defaults: PjaxSettings

PJAX default settings.

Methods

public click(event: JQueryEventObject, options?: PjaxSettings)

PJAX on click handler.

Parameters

  • event: JQueryEventObject

    A jQuery click event.

  • options?: PjaxSettings optional

    PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:

    • container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
    • push: a boolean indicates whether to pushState the URL. Default is true.
    • replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.

public click(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings)

PJAX on click handler.

Parameters

  • event: JQueryEventObject

    A jQuery click event.

  • containerSelector?: string optional

    A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody).

  • options?: PjaxSettings optional

    PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:

    • container: a jQuery selector indicates where to stick the response body. The containerSelector parameter has priority.
    • push: a boolean indicates whether to pushState the URL. Default is true.
    • replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.

public disable()

Disable pushState behavior. This is the case when a browser doesn't support pushState. It is sometimes useful to disable pushState for debugging on a modern browser.

public enable()

Install pjax functions on $.pjax to enable pushState behavior. Does nothing if already enabled.

public reload(): JQueryXHR

Reload current page with pjax.

Returns

JQueryXHR

public submit(event: JQueryEventObject, options?: PjaxSettings)

PJAX on form submit handler

Parameters

  • event: JQueryEventObject

    A jQuery click event.

  • options?: PjaxSettings optional

    PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:

    • container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
    • push: a boolean indicates whether to pushState the URL. Default is true.
    • replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.

public submit(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings)

PJAX on form submit handler

Parameters

  • event: JQueryEventObject

    A jQuery click event.

  • containerSelector?: string optional

    A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody).

  • options?: PjaxSettings optional

    PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:

    • container: a jQuery selector indicates where to stick the response body. The containerSelector parameter has priority.
    • push: a boolean indicates whether to pushState the URL. Default is true.
    • replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.