Closed brano543 closed 2 years ago
Pjax requests can be identified by the x-pjax
HTTP request header field. Pjax config shouldn't be changed by the server response.
Thank you for your response. What is still not clear to me is what is mentioned in the documentation here https://falsandtru.github.io/pjax-api/ which states "Multiple area update" support.
Imagine that I have a handler setup correctly and I check the x-pjax header, how would I tell the plugin to correctly update 2 parts in the webpage - ajax would send new filter form and new content body.
See the usage section. This config updates the header and the primary element if present.
new Pjax({
areas: [
// Try the first query.
'#header, #primary',
// Retry with the second query when the first query doesn't match.
'#container',
// Retry.
'body'
]
});
I have checked the usage section multiple times and it is not clear to me. Would you be so kind and answer my questions to give me clarity?
Example: One clickable link Test link Html wil contain two divs, one with #header, second #primary.
Questions:
Hello,
thank you very much for writing this library. I would like to use your library to implement filter and pagination functionality on my site. There will be three elements that get affected after user clicks:
I am having trouble to understand how I need to setup the backend and point pjax-api to the URL. I am using Wordpress so I need to route to admin-ajax.php endpoint which would handle the request. Moreover how can I tell pjax-api on how to populate the above elements with right content?
Thank you in advance.