Code Monkey home page Code Monkey logo

Comments (5)

MosheGross avatar MosheGross commented on June 12, 2024 4

I found this to be the easiest option

$(document).on('pjax:end', function(event) {
    // my code here 
}).trigger('pjax:end');

basically triggers the events attached to pjax:end

from jquery-pjax.

drewminns avatar drewminns commented on June 12, 2024

Hi there,

You can try using the jQuery Migrate Plugin to add in support for any missing jQuery methods or properties that were removed as jQuery was developed into newer versions.

In my case, I was receiving errors regarding event.props being undefined.

jQuery Migrate Plugin

from jquery-pjax.

buttflattery avatar buttflattery commented on June 12, 2024

@drewminns i aint getting any errors on console i dont think jquery migrate could work in this situation other than the one you pointed out you were facing

from jquery-pjax.

amywieliczka avatar amywieliczka commented on June 12, 2024

Just dealt with this myself - $(document).on('ready') was deprecated in jQuery 3.0, and even before that, the handler wouldn't run anyway if the DOM is ready before the event is attached: discussed in the documentation here: https://api.jquery.com/ready/ under the list of ways to attach a function that will run when the DOM is ready. (Deprecation note here: https://jquery.com/upgrade-guide/3.0/#breaking-change-on-quot-ready-quot-fn-removed)

I wound up doing something like this:

handler = function() { ... }
$( handler )
$(document).on('pjax:end', handler)

I went to file a PR to the README here, but realized the ready event handler has never received any arguments (as shown in the jquery pjax README), so I'm not sure what event.target in the documentation refers to in the case of the ready event firing.

from jquery-pjax.

TheBoringBOT avatar TheBoringBOT commented on June 12, 2024

Just dealt with this myself - $(document).on('ready') was deprecated in jQuery 3.0, and even before that, the handler wouldn't run anyway if the DOM is ready before the event is attached: discussed in the documentation here: https://api.jquery.com/ready/ under the list of ways to attach a function that will run when the DOM is ready. (Deprecation note here: https://jquery.com/upgrade-guide/3.0/#breaking-change-on-quot-ready-quot-fn-removed)

I wound up doing something like this:

handler = function() { ... }
$( handler )
$(document).on('pjax:end', handler)

I went to file a PR to the README here, but realized the ready event handler has never received any arguments (as shown in the jquery pjax README), so I'm not sure what event.target in the documentation refers to in the case of the ready event firing.

@amywieliczka
Could you explain a little more on this with your fix. I wasn't sure how to implement what your fix

from jquery-pjax.

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.