Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

JSON object request response using AJAX

Go to End

3 Posts   2592 Views


Community Member, 2 Posts

14 January 2011 at 10:32am

I managed to connect to a JSON server using ajax and the sapphire Restful server api, but I am not able to display the dynamic data using a template file as my module code is not able to find the template file.Upon a ?debug_request=1. the code stops execution here
Latest request params: array (
'Action' => 'display',
'ID' => '8298574',
'OtherID' => NULL,

and if I use the $this->renderWith('displaypage'); or return $this->renderWith(array('displaypage','Page')); on my dataobject it goes for an infinite loop.

template code in file is
<% if display %>
<% end_if %>

Is there anyway that my controller can default to handle request as the above and display the template both on AJAX and without.....?

Any thoughts will be helpful

Rubin Thomas
(SS Newbie)


Forum Moderator, 1391 Posts

16 January 2011 at 4:41am

I do see an infinite loop coming up - if I get you right, that is. Looks like your url is something like


This means action 'display' will trigger the display() method on your page. This method then starts to render you page using your template. In your template, the <% if display %> again triggers your display() method that then starts to render your page using the template, and... Loop accomplished!

So if this is the situation, you could try and remove <% if display %> If something really does need checking, you could create some CheckFirst() method in your page controller and use <% if CheckFirst %>

Hope this makes some sense :-)


Community Member, 2 Posts

17 January 2011 at 10:10am

Hi Martimiz,

Thanks for the great help....It could be an infinite loop but I dont know which template is being assigned to my controller basically...
basically my url is something like this:


where displaymanager is my module I am developing... and the page I am using is
display and the action is also display and the ID is 8298575 via an ajax call
'Action' => 'display',
'ID' => '8298575',
'OtherID' => NULL,

Is this because I cannot use a page name as display and the method as the same "display"