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

--~--~---------~--~----~------------~-------~--~----~
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