Skip to content

Fallback behavior when push is false #341

@JoshClose

Description

@JoshClose

There are scenarios when I would like a container updated with data from the server, but I don't want the URL changed. In this case I can set the option { push: false }. This works fine in a pushState environment, but when fallbackPjax is used, this will submit a form and I will get a full page load with the wrong content and url.

What would fix this is to have the fallback use the normal ajax loading if { push: false } so the container is still loaded as normal, but the state isn't changed.

Thoughts?

My scenario is cascading drop downs. Currently the only thing I can think of is to update the url with the selected drop down value, and have the whole page (minus layout) refreshed. What I really want is only the options in the select updated.

I could always manually do this via

$.ajax({
    url: "...",
    type: "get",
    headers: { "X-PJAX": true },
}).done(function(data){
    container.html(data);
});

and load the content myself but I'd rather use $.pjax to do it. This means I would have to do some more error handling and other things, which means wrapping this stuff in a common function somewhere... It would be nice to continue to do

$.pjax({ url: "...", container: "#el", push: false });

and let pjax do it's thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions