Topic: How to push a php array reference into a xajax function?
Hello, I'm using a model-view structure in my php module. When the view is loaded, all of the necessary database operations are done once, and the final array is pushed into the view as $this->data.
Is there a way that I can access this array from a xajax function?
I've tried this:
Code: PHP
$hideDet =& $xajax->register( XAJAX_FUNCTION, 'hideDetails' );
$hideDet->setParameter( 0, XAJAX_JS_VALUE, $this->data );
My function looks like this:
Code: PHP
function hideDetails( $theData ){
$response = new xajaxResponse();
//more code: blah blah blah
foreach( $theData as $c ){
//do some stuff with $c
}
//blah blah
return $response;
}
and at the <body>, this:
Code: PHP
<a href="javascript:;" onclick="<?php $hideDet->printScript(); ?>">Hide Details</a>
When I watch the generated sourcecode, I have this:
Code: PHP
<a href="javascript:;" onclick="xajax_hideDetails(Array)">Hide Details</a>
Should I use another indicator instead of XAJAX_JS_VALUE ?
When I alert( $theData ), the content is NULL.
Thanks.