On your ajax calls use the .json

so

http://mysite.com/init/default/index/ for normal pages

http://mysite.com/init/default/index.json/ to get the dict converted to json

or

index.xml to get it in xml format..

-Thadeus




On Tue, Nov 24, 2009 at 10:06 PM, Alex <[email protected]> wrote:

>
> Hello,
>
> I have "get_workout" action in controler and this action could be
> called either directly using GET method, or could be called using
> AJAX.
>
> If it's called using GET it should return (render) whole page.
> If it's called using AJAX it should return (render) only a part of the
> page
>
> It's not clear how to do it using web2py
>
> I wanted to check inside controller method if current request it GET /
> POST or AJAX and then change the logic of the method but didn't find a
> way to check if current request is AJAX, how to do it?
>
> I use such kind of link:
> <a href="{{=URL('gym','default','get_workout')}}" onclick="ajax('{{=URL
> (r=request,f='get_workout')}}', [], 'fitness_goals');return false;">
> {{=a.title}}</a>
>
> The base idea is to make partial page update using AJAX with loading
> banner displaying during update and page opening using non-AJAX
> request when whole page HTML will be loaded.
>
> What is the best way to do it?
>
> Thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to