Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need AJAX help

  • @egerrits

    Participant

    Hi folks,

    I am in deperate need of someone who can help me implement some AJAX code for bp-events. I am having real trouble getting my plugin to work with BP trunk. It just doesn’t seem to want to load or call the AJAX code which is very much needed in handling any button click/tab press.

    I have copied and changed the groups ajax/js code used for friend lists/join/leave buttons and directory view/my-events tab clicks but I just can’t seem to get it going. Things changed quite a lot from 1.1.3 to 1.2 (or trunk)…

    I need a fresh pair of eyes that know what they are doing ;)

Viewing 9 replies - 1 through 9 (of 9 total)
  • @boonebgorges

    Keymaster

    I can’t promise that I know what I’m doing :) but I might be able to take a look at it.

    @dpolant

    Participant

    I just got some ajax to work in 1.2 – I’ll take a look. Where can I get the code you’re working on?

    @egerrits

    Participant

    Thanks, guys.

    I zipped up my latest code here:

    http://erwingerrits.com/bp-events.zip

    It installs and loads without errors, but the AJAX never gets loaded. BuddyPress just loads AJAX.php and global.js, automatically handling all Groups scripts, so I have to copy the relevant code into a seperate ajax & global file and load it.

    @egerrits

    Participant

    It won’t even attempt to load the javascript files for the widget… it creates the widget, but the enqueue_script won’t add the javascript to the header, even though I have checked the URL about a zillion times…

    if ( is_active_widget( false, false, $this->id_base ) )
    wp_enqueue_script( 'events_widget_events_list-js', WP_PLUGIN_URL .
    '/bp-events/js/widget-events.js', array('jquery', 'jquery-livequery-pack') );

    This seems to be OK.

    @egerrits

    Participant

    I got a “jQuery(“div#events-list-options a”).livequery is not a function” error when loading the events widget javascript, which is exactly the same as groups widget js and loaded at the same time (from the widget constructor).

    What does this error mean?

    @sbrajesh

    Participant

    hi Erwin

    It seems bp-default theme is no more using livequery.

    If you are trying to load something after activity has loaded(using ajax), then I have also the same problem.

    I had opened this ticket and waiting for an official response from Andy or JJJ

    https://trac.buddypress.org/ticket/1616

    @apeatling

    Keymaster

    just replace .livequery() with .live() since this is now built into jQuery.

    @sbrajesh

    Participant

    Thanks Andy for the info.

    Yes, live() works as a perfect replacement for livequery().

    Any thought about how do we detect when activity is loaded, or anyway we can call our custom javascript functions after activity is loaded using ajax.

    @egerrits

    Participant

    Thanks Andy!

    Does this mean we no longer need ‘jquery-livequery-pack’ in the enqueue script?

    And As Brajesh, I too am having trouble trying to figure out WHEN to load custom javascripts…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Need AJAX help’ is closed to new replies.
Skip to toolbar