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 7678255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:36:12+00:00 2026-05-31T17:36:12+00:00

i am noticing a error when im trying to return json from a fetchAll.

  • 0

i am noticing a error when im trying to return json from a fetchAll.

in the controller i have a fetchAction

$result = $model->fetchAll();
echo Zend_Json::encode($result);
exit();

in a .js file i have a ajax call:

$.ajax({  
    type: "GET",
    url: "/module/index/fetch",
    dataType: "json",
    processData: false,
    success: function(data) {   
       console.log(data);
       $.each(data, function(index, obj){
          // console.log(obj);
       });
    }
});

if i do a print_r($result); i get:

Array
(
    [0] => Module_Model_Module Object
        (
            [_message:protected] => test
            [_created:protected] => 1332188757
            [_dependent_table:protected] => 
        )

    [1] => Module_Model_Module Object
        (
            [_message:protected] => 123123
            [_created:protected] => 1332194812
            [_dependent_table:protected] => 
        )

)

but the console.log(data); returns 2 empty json objects: [{},{}].

any ideas why i get the json empty back??

  • 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-31T17:36:14+00:00Added an answer on May 31, 2026 at 5:36 pm

    my guess is that Zend_Json is not able to transform the Module_Model_Module objects into arrays and then into JSON, you could try to call toArray to the objects and see if then Zend_Json can properly encode them

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

Sidebar

Related Questions

I'm noticing this error more and more in my error logs. I've read through
I have a ps1 script that deploys all of my webparts. I started noticing
My company is switching to Mercurial, and we're coming from Subversion. We're noticing that
I've been trying to trace this error for nearly 2 days now and I
Possible Duplicate: Why does gcc have “â” in all its error messages? New to
I've been noticing this error on Chrome's console for a while now: I modified
I have been noticing that when I pull changes to my server that it
I'm trying to get a string using a http call. I am noticing that
So I have elected to play with jQuery 1.4 - and I am noticing
I have custom error pages setup using <customErrors mode=On defaultRedirect=~/Home/Error> <error statusCode=404 redirect=~/Home/PageNotFound />

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.