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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:23:59+00:00 2026-05-27T09:23:59+00:00

This is follow up post where I’m having a problem where my php code

  • 0

This is follow up post where I’m having a problem where my php code is not returning the data it should. I have this api.php code (under Joomla):

<?php
require_once ( 'includes/defines.php' );
require_once ( 'includes/framework.php' );

/* Create the Application */
$app = JFactory::getApplication('site');

/* Make sure we are logged in at all. */
if (JFactory::getUser()->id == 0)
    die("Access denied: login required.");

//get current user
$user =& JFactory::getUser();
// get a reference to the database
$db = &JFactory::getDBO();

$query_camera_name = "SELECT camera_name, camera_status, camera_quality, email_notice, camera_hash, camera_type FROM #__cameras WHERE user_id=".$user->id." AND camera_status!='DELETED'";
$db->setQuery($query_camera_name);
//get number of cameras so we can build the table accordingly
$db->query();
$num_rows = $db->getNumRows();
// We can use array names with loadAssocList.
$result_cameras = $db->loadAssocList();
header('Content-Type: application/json');
echo json_encode($result_cameras);
?>

This code on its own returns valid JSON code. Then I have my client.php code that is there to display some results.

<html>
<head>
<link href="ajax_dashboard/webcam_widget.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
</head>
<body>

<h3>Output: </h3>
<div id="output">Append this text</div>

<script id="source" language="javascript" type="text/javascript">
var js = jQuery.noConflict();

js(function () 
{
js.ajax({                                      
  url: 'ajax_dashboard/api.php',                  //the script to call to get data          
  data: "",                        
  dataType: 'json',                //data format      
  success: function(data, textStatus, xhr) {
    console.log(xhr);
    js.each(data, function() {

       js.each(this, function(k, v) {
           js('#output').append("<b>key: </b>"+k+"<b> value: </b>"+v);

    });

   });

} 
});
}); 
</script>
</body>
</html>

I have verified with help from users on another post that the jquery code is just fine (http://stackoverflow.com/questions/8329495/iterate-over-json-array-using-jquery). The error I’m getting is from jquery

object is null

The extra console message gives this as well: Object { readyState=4, status=200, statusText=”OK”} and responseText=””

For some reason the JSON code is not coming through right. Here is what happens when I look at the JSON code for those who want to verify:

[
{
    "camera_name": "ffgg",
    "camera_status": "DISABLED",
    "camera_quality": "MEDIUM",
    "email_notice": "DISABLED",
    "camera_hash": "0d5a57cb75608202e64b834efd6a4667a71f6dee",
    "camera_type": "WEBCAM"
},
{
    "camera_name": "test",
    "camera_status": "ENABLED",
    "camera_quality": "HIGH",
    "email_notice": "ENABLED",
    "camera_hash": "6ab000ef7926b4a182f0f864a0d443fc19a29fdd",
    "camera_type": "WEBCAM"
}
]

I’m thinking it has something to do with the way Joomla is displaying this. Any ideas?

  • 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-27T09:23:59+00:00Added an answer on May 27, 2026 at 9:23 am

    Decided to answer my own question. It is just not possible to do this. I have to go the component route (create your own custom component). As far as I can see there is just no other way.

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

Sidebar

Related Questions

I have an issue I have this jQuery code: $(document).ready(function(){ $(#follow).click(function(){ $.ajax({ type: 'POST',
I have follow this post to make ImageButton in android android image button The
I have a bunch of python methods that follow this pattern: def delete_session(guid): conn
This is a follow-up of the post at Ada: plotting 2d graphs . I
I'm trying to follow this blog post: http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx My aim is to somehow get
This is a follow-up question to a different question I asked not too long
This is a follow up post to this one: Recursively search nested lists I've
I follow this answer to post a photo on Facebook. How can I add
Quick sum up: I have a social website where users can follow/post/vote etc. I
This is a follow-up question to my previous post: Python/Scipy Interpolation (map_coordinates) Let's say

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.