Twitter
Fri
10
Jul
'09
PDF
Print
Send
 
Hits (1706) | Comments (0) | Favorited (1) | Votes (0)

Resources have universal interface to call Xajax. It is very simple. Example with Field plugin. In your plugin output add JavaScript code.

function onRenderField(&$obj, &$params, $type)
{
  if($type != 'myfieldname') return;
  echo '<div id="id_100"></div>';
  echo '<a href="javascript:void(0);"';
  echo 'onclick="';
  echo "xajax_jsCallPlugin('joomsuite_content_fields', 'myfieldname', 'xajax_sayHello', [100, 'Hello']);";
  echo '">';
  echo JText::_('Click Here').'</a>';
}

It is not hte best coding. I devided string to few echo's because of GEHSI format. YOu can echo it as one string;

xajax_jsCallPlugi parameters

  • joomsuite_content_fields -Group where is the plugin with Ajax function
  • myfieldname - Name of the plugin. It is value of "element" field in #__plugins table
  • xajax_sayHello - Name of the function in that plugin. Important that in the name word xajax should present.
  • [100, 'Hello'] - Array of values.

Then in the same plugin you create function.

function xajax_sayHello( &amp;$objResponse, $id, $word ) {
  $objResponse->script('alert("I am Here");');
  $objResponse->assign("id_{$id}", 'innerHTML', $word);
  $objResponse->setReturnValue( 1 );
}

Note that first parameters in this function is always $objResponse. You do not need to return it just call its functions. Then you add as many parameters as mane you place in last parameter of xajax_jsCallPlugin inside [ ]

 


Comments

There are no comments for this item

Be the first to leave a comment

Add New Comment
Name:
Email:
Comment:
Attachment
Hide Comment
Security code:
Enter text as you see on image
 
 
What is best way for Download/Installation MightyExtensions?
 


Member Area



Member Activity

We have 2092 guests and 12 members online


MightyTemplate - Professional Joomla Templates