7.1.2.2 remoteFunction
remoteFunction(array $options);
This function creates the JavaScript needed to make a remote call. It is primarily used as a helper for link(). This is not used very often unless you need to generate some custom scripting.
The $options for this function are the same as for the link method
Example:
<div id="post">
</div>
<script type="text/javascript">
<?php echo $ajax->remoteFunction(
array(
'url' => array( 'controller' => 'posts', 'action' => 'view', 1 ),
'update' => 'post'
)
); ?>
</script>
<div id="post"></div><script type="text/javascript"><?php echo $ajax->remoteFunction(array('url' => array( 'controller' => 'posts', 'action' => 'view', 1 ),'update' => 'post')); ?></script>
It can also be assigned to HTML Event Attributes:
<?php
$remoteFunction = $ajax->remoteFunction(
array(
'url' => array( 'controller' => 'posts', 'action' => 'view', 1 ),
'update' => 'post' )
);
?>
<div id="post" onmouseover="<?php echo $remoteFunction; ?>" >
Mouse Over This
</div>
<?php$remoteFunction = $ajax->remoteFunction(array('url' => array( 'controller' => 'posts', 'action' => 'view', 1 ),'update' => 'post' ));?><div id="post" onmouseover="<?php echo $remoteFunction; ?>" >Mouse Over This</div>
If $options['update'] is not passed, the browser will ignore the server response.


























