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

  • Home
  • SEARCH
  • 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 7568165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:51:14+00:00 2026-05-30T14:51:14+00:00

I am currently creating a mobile application. I am using cakephp2.0 as my backend

  • 0

I am currently creating a mobile application. I am using cakephp2.0 as my backend to handle the request and response. I would want cakephp to handle the request and send a json response back to the mobile application (application craft).

(1) For users controller, i did this:

   public function index() {
      $this->autoRender = false;
      return new CakeResponse(array('body' => json_encode($this->User->find('all'))));
   }

(2) AppController i did this:

var $components = array('RequestHandler');
function beforeFilter() {
    if ( $this->RequestHandler->isAjax() ) {
            Configure::write ( 'debug', 0 );
    }
}

(3) I created separate html file which is not in cakePHP folder to test json response:

<body>
<a href="">jQuery</a>
    <script type="text/javascript">
         $(document).ready(function(){
                $.ajax({
                    type: "get",
                    url: "http://localhost/jungle/users",
                    success:  function(response){                    
                    alert(response);
                    }
                });

         });
       </script>

</body>

I am not getting any response from the cakephp backend when i open the html file mentioned in (3). I tried using the firebug and there were no response shown too.

However, when i tried accessing the cakephp users index page from my browser, the json is displayed out nicely:

[{"User":{"id":"1","name":"John","mobile_code":"+65","mobile number":"901111234"}}]

Could someone help me?

  • 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-30T14:51:15+00:00Added an answer on May 30, 2026 at 2:51 pm

    There is nothing wrong with your setup. I know this sounds silly, but have you included jQuery properly in your test HTML and is it successfully firing off the request?

    Another thing to verify is where are you hosting your test HTML file? Is it being served from the webserver or is it just sitting on your desktop? If it is not being served, there is a good chance that javascript is disabled and not running.

    As an aside, isAjax is deprecated in CakePHP 2. Instead, use this->request->is( 'ajax' ) to test for Ajax. This should not affect your problem though.

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

Sidebar

Related Questions

I'm currently creating a user interface using WPF and would like to display a
Does Using Namespace; consume more memory? I'm currently working on a mobile application and
I am currently creating a mobile version of my company's site and using it
I am currently creating a application and would like to add a AJAX feature,
I am currently creating an application which signals readiness to other devices using a
I'm currently creating an application for a customer that will allow them to automatically
I am currently creating an e-commerce site using C# ASP.NET MVC and have just
Im currently creating a tile-based game for android. Using java via dalvik JVM. im
I am currently building a game in phonegap using jQuery Mobile frame work. What
I'm currently creating both the client and server app using ActiveResource for web servicing.

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.