function slickgrid_json in Slickgrid 6
Return data in JSON format. Using drupal_json() results in a parse error client side on some html content So use json_encode instead
Parameters
$var: (optional) If set, the variable will be converted to JSON and output.
4 calls to slickgrid_json()
- slickgrid_callback in ./
slickgrid.callbacks.inc - hook_menu callback; Universal callback - builds function name and returns error = true
- slickgrid_content_add_more_js in ./
slickgrid.ahah.inc - Menu callback Copy of content_add_more_js() except uses slickgrid_json rather than drupal_json
- slickgrid_filefield_js in ./
slickgrid.ahah.inc - Copy of filefield_js() using slickgrid_json() rather than drupal_to_js()
- slickgrid_nodereference_autocomplete in ./
slickgrid.ahah.inc
File
- ./
slickgrid.module, line 793
Code
function slickgrid_json($var = NULL) {
drupal_set_header('Content-Type: text/javascript; charset=utf-8');
if (isset($var)) {
echo json_encode($var);
}
exit;
}