Coder Social home page Coder Social logo

Comments (4)

falsandtru avatar falsandtru commented on May 15, 2024

Pjax requests can be identified by the x-pjax HTTP request header field. Pjax config shouldn't be changed by the server response.

from pjax-api.

brano543 avatar brano543 commented on May 15, 2024

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.

from pjax-api.

falsandtru avatar falsandtru commented on May 15, 2024

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'
  ]
});

from pjax-api.

brano543 avatar brano543 commented on May 15, 2024

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:

  1. How do I tell the Pjax on which elements to listen? In this case "test" link.
  2. How should I format the response from /api/test endpoint so that it can render
    Hello
    under #header and
    World
    under #primary.

from pjax-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.