This will be a cool thing for our ajaxchat, or eventually for searchmembers or signup location picker.
See the #116 ajaxchat application for how to use.
JSON
- ajax request string must be '.../json/ajaxchat/...' (for ajaxchat application)
- framework will call !AjaxchatController::json($args, $json_object), where
- $json_object is a stdClass object, waiting to be filled with values.
- $args provides you with $args->request, $args->post, $args->get.
- all text output (echo) is buffered, so it does not break the json notation.
- the contents of the $json_object will be given to the javascript prototype callback in json object notation.
- in the prototype callback function "my_callback_func(transport)", you get the object by "transport.responseJSON".
- "transport.responseJSON.text" is the buffered text. You can display it somewhere in a div box, in an alert, or what you like.
- "transport.responseJSON.alerts" is an array of alert texts. You are supposed to fire these alerts to the user..
- you can define other attributes in the json object, as you prefer.
XML
- not yet implemented..
- ajax request string would be '.../xml/searchmembers/...' (for instance)
- framework would call !SearchmembersController::xml($args)
- in some way the framework will make sure that the output is valid xml, and that whatever error messages will not break that.