On Wed, 2007-26-09 at 01:02 +0200, Christopher Arndt wrote:
> iain duncan schrieb:
> > I've read the docs on returning json, and can see that if I use
> > 'allow_json=True' that the controller will detect that we want json
> > based on either tg_format="json" or headers with accept javascript.
> > 
> > What I can't figure out is how I can detect *within* controller code
> > what kind of return we'll be doing.
> 
> By convention, most JavaScript libraries will add a special HTTP header
> "X-Requested-With: XMLHttpRequest" to all AJAX request.
> 
> See the is_xhr function in the new Genshi tutorial for a way to detect this:
> 
> http://genshi.edgewall.org/wiki/GenshiTutorial#AjaxifiedCommenting
> 
> 
> HTH, Chris

Thanks Chris, that does help at least get me on track. I'm hoping to
find out from controller code though. I figure there must be a single
flag or mechanism that is set if the controllers know when to return
json. I just need to know how to directly access that from within a
controller method, but don't see that mentioned in the json docs.

If someone knows, I'd be happy to add an example of what I'm doing to
the json docs.

Iain



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to