Ok, I've made some progress. I invoke a JQuery.getJSON as follow:
jQuery.getJSON('[(base_url)]populatePage.php?docID='+pageID, function(data) {
var items = data;
});
But when I get the array back, it is undefined and empty. This is how my populatePage.php looks like. What am I doing wrong?
<?php
$docId = $_GET['docID'];
$path = dirname(__FILE__).'/';
include_once($path.'modxapi.php');
$modx = new MODxAPI();
$img = $modx->runSnippet('GetField', array('docid'=>$_GET['docID'], 'field'=>'article_img'));
$desc = $modx->runSnippet('GetField', array('docid'=>$_GET['docID'], 'field'=>'image_desc'));
$title = $modx->runSnippet('GetField', array('docid'=>$_GET['docID'], 'field'=>'pagetitle'));
$text = $modx->runSnippet('GetField', array('docid'=>$_GET['docID'], 'field'=>'article_text'));
$result = array(
'img' => $img,
'desc' => $desc,
'title' => $title,
'text' => $text
);
echo $result;
?>
Thanks for helping out as I am stuck....