Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need AJAX help

  • Avatar of Erwin Gerrits
    Erwin Gerrits
    Participant

    @egerrits

    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)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

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

    Avatar of dpolant
    dpolant
    Participant

    @dpolant

    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?

    Avatar of Erwin Gerrits
    Erwin Gerrits
    Participant

    @egerrits

    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.

    Avatar of Erwin Gerrits
    Erwin Gerrits
    Participant

    @egerrits

    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.

    Avatar of Erwin Gerrits
    Erwin Gerrits
    Participant

    @egerrits

    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?

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    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

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

    Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

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

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    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.

    Avatar of Erwin Gerrits
    Erwin Gerrits
    Participant

    @egerrits

    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)

You must be logged in to reply to this topic.