/**
* Return some JSON or JSONP to the page.
*/
function _project_browser_server_return($results) {
// JSONP
if (!empty($_GET['callback'])) {
// @todo msie9 might break with this content-type.
// @see http://stackoverflow.com/questions/111302/best-content-type-to-serve-jsonp/111306#111306
backdrop_add_http_header('Content-Type', 'application/javascript; charset=utf-8');
print $_GET['callback'] . '(' . backdrop_json_encode($results) . ');';
}
else {
backdrop_add_http_header('Content-Type', 'application/json; charset=utf-8');
print backdrop_json_encode($results);
}
}
In Drupal this produces the json output and nothing else.
In Backdrop it produces the json output followed by the html for a page.
I am wondering how to suppress the html which I assume is added by the layout system. Is it possible to bypass the layout system for specific paths? I would like to be able to choose 'no layout' where there is a choice of 1 column etc.
Any suggestions would be much appreciated. My other inclination is to build a simple non-Backdrop server page just to generate the test data in json form so we can proceed with testing with Backdrop rather than Drupal data.
I have just had a thought - as a temporary expedient I can use an installation of project_browser_server on a Drupal site and just modify the test data in pbs_example.module to get the right json data. But we will need it on Backdrop for the final system.