How to use a JUMI file in AJAX callback on Joomla

2k Views Asked by At

I'm trying to use a JUMI file (a component for Joomla that allows me to get aceess to Joomla MVC) in AJAX callback. The structure is like this:

  1. file.php that calls AJAX file is already a JUMI file.
  2. file ajax.js (included in file.php) makes the call.
  3. file.tooltip.php is a JUMI file which output is shown on file.php. It needs to be a JUMI because I need to access Joomla libraries to get the data it processess.

To prevent the problem that JUMI outputs a file with all the template I'm using in the Joomla call method in the end of the url in ajax.js: &tmpl=component. It works, but however it brings together all other calls for javascripts and so on contained in the template, which is bringing me to conflicts. The page is very slow and other javascript components are not working.

Does anyone know how is the best way to approuch the situation and get to a solution?

Thanks a lot!

2

There are 2 best solutions below

0
On BEST ANSWER

You need to use &format=raw at the end of the url to the file you're ajax'ing to. Chances are though, that you get a server error because that "view is not supported". Easy fix, go to your site

root/components/com_jumi/views/application/

then make a copy of view.html.php called view.raw.php.

This component REALLY needs to be updated.

0
On

So you have a file, file.php, that has something like this in it?

<script type="text/javascript">
  $(document).load( function() {
    $('#this_id').click(function() {
      $('#that_id').hide();
    });
  });
</script>

<div id="this_id">click me</div>
<div id="that_id">hello and goodbye!</div>

And then you want to access a file called "file.tooltip.php" that is also a Jumi file?

I don't know why that would need to be a Jumi file, it could be a simple php file that gets called in your javascript. To access the underlying Joomla libraries, you would simply invoke the appropriate library in the PHP file.

I hope this helps... Bud