I am wondering if my problem has a link with the previous bog I wrote about some hours ago...
I have an ajax call to pages. The code is based on:
The only difference is that since I use the TemplateFactoryEngine, I must add an exit() command in the code.
So, in my template file (controller), I wrote this:
if($config->ajax) {
$json = array(
'id' => $page->id,
'title' => $page->title,
'body' => $page->body,
'photos' => $photos
);
// Output your json
echo json_encode($json);
// halt template rendering
exit();
}else{
$view->set('photos',$photos);
}
and the AJAX call is made by script:
$('#menuAlbum li').on('click', function () {
var url = $(this).find('.chemin').text();
$.getJSON(url, function (data) {
if (data) {
....
Now the weird part:
When I am logged, everything is fine.
When I am not logged, no data is returned.
($this->halt() does not work in that context)
I receive no error, I checked that the script was running when not logged (the url is retrieved).
How can data can be fetched when logged and not fetched when not logged?