But how can controller method know if current request is POST / GET or
AJAX?

Sometimes it's needed to generate very different part of HTML page and
return it to update some DIV on the page.

On Nov 25, 6:09 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> 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 <person...@gmail.com> 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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to