Data Objects: Using AJAX Functions

About Ajax Data

BB Website Plugins can retreive data from the Beat Brokerz database in real time (on demand). This data can be used to populate content on the page, or for use as input to your custom processing script. It is retreived using a technology called 'ajax'.

A basic example would be when the beat changes on an mp3 player. If the 'ajax' feature is turned on (see below), then your 'bbmp3_songchange' event processing function will receive a data object as the third argument. This data object contains specific information about the new beat that's playing (such as title, description, licensing, buy now, etc). You can then use this information to update or change content on the page in real time.

How It Works

Turn It On:
First you have to turn the feature on in your processing script. Here is an example on how to do that.

<script type="text/javascript">

    ajax: true,   /* turns ajax feature on */


Ajax enabled events:
Currently, the following events receive the optional data object as an argument.

bbmp3_songchange : (playerID, songID [,data])
Note: only the 'render' and 'after' hooks receive the data object for this event.

Object Properties:

How to use the data object in the 'bbmp3_songchange' event:

<script type="text/javascript">

  $.appflow.bind('bbmp3_songchange','render',function(playerId, beatid, data) {
    // fill elements on the page
    // the following line adds the fully qualified domain name to the form submit action
    $('.bbmp3-cartform form').attr('action','' + $('.bbmp3-cartform form').attr('action'));