Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

JSON output from my component? 06 Dec 2012 14:10 #5863

Posted this in the wrong forum earlier, so reposting here assuming the other will be removed. I've been googling this, and have several vague answers, generally about earlier versions of Joomla.

My component needs to interact with another system that we have, so I'm trying to accomplish "api-like" functionality such as something like this example of other system getting total hits on a particular record in my Cook component:
index.php?option=com_mycomponent&view=MyApiView&layout=GetHits&MyParm=1234
It is my hope (in addition to all the normal layouts/views) that my component will be able to return only valid JSON output something like this that can be used in the jQuery of the other system that record ID 1234 has had 75 hits:
{
  "MyParm": "1234",
  "totalhits": "75"
  "lasthit": "2012-12-05 13:05:47"
}
Is there any hope that there is some magic "sweet spot" in the Cook code that could help me get there quicker than sifting through all these Google results and trying to apply them to the generated code?

Please Log in or Create an account to join the conversation.

Last edit: by gdpodesta. Reason: Better example relative to cook

Re: JSON output from my component? 07 Dec 2012 17:15 #5901

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.055 seconds
I have been using Cook for only a day now and it is the next best thing to Jagermeister. It is very easy to use and I see some of the greatest Joomla Components ever! coming from Cook users.
Naude (Forum)

Get Started