updating J1.5 to J2.5 mootools json requests now expectng a view?

193 views
Skip to first unread message

Techbot

unread,
Feb 9, 2012, 1:22:12 PM2/9/12
to joomla-de...@googlegroups.com
Hi All,

I'm attempting to update my J1.5 component to 2.5.

there are numerous json requests similar to the following

<script type='text/javascript'>

function get_players(){
 
  var a = new Request.JSON({
  url: "index.php?option=com_battle&format=raw&task=action&action=heartbeat",
  onSuccess: function(result){

              // do nothing for the moment
               }
  }
  }).get();
 
  } // end get players
</script>

In my controller I have

function action(){
   
         $result='hello';

    echo Json_encode($result);
   
}

This worked fine in J1.5 but in J2.5 I get

View not found [name, type, prefix]: single, raw, battleView

I do not want to use a view, I have numerous little calls and views are not necessary. Any suggestions?


thanks

Rob

Techbot

unread,
Feb 12, 2012, 1:01:19 PM2/12/12
to joomla-de...@googlegroups.com
Hi

Can I get a confirmation that the code above should work.

the alternative is that I create the view that it seems to be looking for by default. But if I do that any other json call will also default to this view and I get one response regardless of task in url.

As usual when I got stuck, I've been stuck for two days. :-)

jose

unread,
Feb 12, 2012, 1:03:08 PM2/12/12
to joomla-de...@googlegroups.com
Hi there,


2012/2/12 Techbot <djte...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/SjuQZrYujX4J.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.



--

  Best Regards
  Jose Manuel Revuelta Gutierrez
  COMMUNITY MANAGER

 DIVERS AROUND
 in...@diversaround.com
  Underwater social Network for Divers
  www.diversaround.com
   Sharm el Sheik ( Sinai )  Egypt
   mobile phone. 0107-5835166


jose

unread,
Feb 12, 2012, 1:05:17 PM2/12/12
to joomla-de...@googlegroups.com
Hi there,

I think it must have been some kind of mistake because I do not know what are you talking about what so ever,but sounds important so Just to let you know you have the wrong person here.
Good luck with your issue.

Jose

2012/2/12 jose <sharkd...@gmail.com>

Sam Moffatt

unread,
Feb 12, 2012, 2:01:08 PM2/12/12
to joomla-de...@googlegroups.com
Try format=json.

Cheers,

Sam Moffatt
http://pasamio.id.au

> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To view this discussion on the web, visit

> https://groups.google.com/d/msg/joomla-dev-general/-/RQ3lpW3eFQsJ.

Rob Stocker

unread,
Feb 12, 2012, 2:15:41 PM2/12/12
to joomla-de...@googlegroups.com
Hi Sam,

I'm guessing by your response that the code above or some thing similar should work and that a view is not mandatory at this stage.

I've tried all the variations including but not limited to
  • tmpl=component
  • format= raw/json    //  results in requiring a view.json.php or view.raw.php
  • rewriting the javascript to match this
var req = new Request({
      method: 'get',
      url: $('index.php?option=com_battle&task=action&action=heartbeat&format=json').get('href'),
      data: { 'do' : '1' },
      onRequest: function() { alert('Request made. Please wait...'); },
      onComplete: function(response) { alert('Response: ' + response); }
    }).send();

I tried this because of the warning on docs:  This article applies to Joomla! 1.5 only as Joomla! 1.6 ships with a later version of MooTools which has a different way of handling Ajax requests. thanks
Rob
--
Rob & Lisa - EMC23
083 416 0618
in...@emc23.com
www.emc23.com

Sam Moffatt

unread,
Feb 12, 2012, 2:35:43 PM2/12/12
to joomla-de...@googlegroups.com
I just created a very quick sample app using code grabbed from here:
http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.7_-_Part_02


index.php?option=com_test&format=json&task=action

Appears to work fine and code attached.

Cheers,

Sam Moffatt
http://pasamio.id.au

test.zip

Rob Stocker

unread,
Feb 12, 2012, 3:54:31 PM2/12/12
to joomla-de...@googlegroups.com
Thanks for your time Sam,

Yours works ,mine doesn't. Should be all i need to figure it out.

again thanks

Rob
Reply all
Reply to author
Forward
0 new messages