XAJAX script not working with Behaviour

View: New views
1 Messages — Rating Filter:   Alert me  

XAJAX script not working with Behaviour

by blueAlien86 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I started using xajax as a php backend ajax updater. I also use
scriptaculous and behaviour. I had behaviour completely working, until
xajax jumped in and updates the whole page after the Behaviour.apply()
functions is called. So I added this at the end of my xajax function
that loads pages.

        $objResponse->script( "Behavious.apply();" );

Although the problem is that it still does not work. I have an xajax
script alert in the function the does work however. All the xajax,
scriptaculous, and other javascript works, except for this. See for
yourself.

Sources:

index.php -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

        <head>
                <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
                <link type="text/css" media="screen" rel="stylesheet" href="includes/
themes/general/index.css" />
                <script language="javascript" type="text/javascript" src="includes/
javascript/scriptaculous/prototype.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/scriptaculous/scriptaculous.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/tiny_mce/tiny_mce.js"></script>

                <script language="javascript" type="text/javascript" src="includes/
javascript/tinymce_config.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/general.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/behaviour.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/proto.menu.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/rules.js"></script>
                <script language="javascript" type="text/javascript" src="includes/
javascript/validation_functions.js"></script>

                <script language="javascript" type="text/javascript" src="includes/
javascript/validation.js"></script>

<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e)
{ xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "http://www.website.com/";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5 Beta 4";
xajax.config.legacy = false;
xajax.config.defaultMode = "asynchronous";
xajax.config.defaultMethod = "POST";
/* ]]> */
</script>
<script type="text/javascript" src="includes/xajax/xajax_js/
xajax_core.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
window.setTimeout(
 function() {
  var scriptExists = false;
  try { if (xajax.isLoaded) scriptExists = true; }
  catch (e) {}
  if (!scriptExists) {
   alert("Error: the xajax Javascript component could not be included.
Perhaps the URL is incorrect?\nURL: includes/xajax/xajax_js/
xajax_core.js");
  }
 }, 2000);
/* ]]> */
</script>

<script type='text/javascript' charset='UTF-8'>
/* <![CDATA[ */
bf_load_page = function() { return xajax.request( { xjxfun:
'load_page' }, { parameters: arguments } ); };
bf_change_theme = function() { return xajax.request( { xjxfun:
'change_theme' }, { parameters: arguments } ); };
bf_update_window = function() { return xajax.request( { xjxfun:
'update_window' }, { parameters: arguments } ); };
/* ]]> */
</script>
        </head>

        <body id="body" onLoad="bf_load_page( 'index' );">

                <div id="wrapper">
        </div>
</body>
</html>

xajax function -
function load_page( $page = '', $action = '', $cat = '', $id = '',
$form_data = array() )
{
        $objResponse = new xajaxResponse();

        $_SESSION['page']['name'] = $page;

        $output = '';
        $output .= ''."\n";
        $output .= generate_header();
        $output .= generate_tabs();
        $output .= generate_sidebar();
        if( $_SESSION['page']['name'] == 'index' ){
                $output .= generate_specials();
        } elseif( strtolower($action) == 'search' ){
                #$output .= generate_search( $form_data['search'], $page );
                $objResponse->alert( 'search' );
                $output .= $form_data['page'] .": ". $form_data['search'];
        } else {
                $output .= generate_content( $action );
        }
        $output .= generate_footer();

        $objResponse->assign( "wrapper","innerHTML", $output );
        $objResponse->script( "alert('hello');" );
        $objResponse->script( "Behavious.apply();" );

        return $objResponse;
}
$xajax->registerFunction("load_page");
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---