weblegs/php-framework — Issue #3: ajax / data-section fix...
Author: rakhavan
Created: 2012-01-26 23:07:02+00:00
State: open

Inside /lib/footprint/Engine.php when we generate the final output for AJAX or data section requests.... we shouldn't add empty items to the output response.

//generate the final output
$outputData = null;
if($isAjaxRequest) {
$tmpJSON = array();
if(count(self::$responseSections) > 0) {
$tmpJSON["sections"] = self::$responseSections;
}
if(count(self::$responseJSON) > 0) {
$tmpJSON["data"] = self::$responseJSON;
}
$outputData = json_encode($tmpJSON);
}
else {
$outputData = self::$doc->toString();
}