Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7658421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:11:58+00:00 2026-05-31T13:11:58+00:00

I have a lithium app set up that way, so when return($data) is used

  • 0

I have a lithium app set up that way, so when

return($data) 

is used it either can be used in the lithium view.html.php as

echo $data

or if request header “accept” equals “json/javacript” it would return something like

{
data: { a:'b' }
}

automatically.

Unfortunately in the new app that I made as a test app that flow is not happening (and only HTML is always returned).

After doing a little research it seems like that it is supposed to be done automatically if I uncomment

require __DIR__ . '/bootstrap/media.php';

inside bootstrap.php But that didn’t work, I still have HTML returned. I downloaded a recent version of the lithium framework(I downloaded it may be 1 or 2 months ago)

Anybody knows if automatic response with JSON requires some set up or not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:11:59+00:00Added an answer on May 31, 2026 at 1:11 pm

    taken from http://dev.lithify.me/lithium/tickets/view/353

    which is then taken from the lithium docs

    To enable automatic content-type negotiation (i.e. determining the content type of the response based on the value of the HTTP Accept header), set the ‘negotiate’ flag to true. Otherwise, the response will only be based on the type parameter of the request object (defaulting to ‘html’ if no type is present in the Request parameters)

    http://li3.me/docs/lithium/action/Controller::$_render

    If you need more help on how to implement leave a comment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a lithium app that I did not set up how do
I have a lithium Html helper link <?php echo $this->html->link('Delete', array('action' => 'delete', 'args'
Have anyone used Redmine Documentor which lets you convert PHP to HTML to Redmine
Have an app that can use tts to read text messages. It can also
I have created a RESTful PHP web service using Lithium which contains comments, each
I would love to sort an embedded MongoDB object using PHP Lithium. I have
I am currently developing a Lithium application and have come across a function that
Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()
Have a rails app that is supposed to display a list of products/managers. After
Have a (rather complex) app that works fine on iOS 4 but fails on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.