/** * Print an ajax response to the browser. * * @param array $strResponseArray An array keyed with QAjaxResponse items. These items will be read by the qcubed.js * ajax success function and operated on. The goals is to eventually have all possible response types represented * in the QAjaxResponse so that we can remove the "eval" in qcubed.js. */ public static function SendAjaxResponse(array $strResponseArray) { header('Content-Type: text/json'); // not application/json, as IE reportedly blows up on that, but jQuery knows what to do. $strJSON = JavascriptHelper::toJSON($strResponseArray); if (QApplication::$EncodingType && QApplication::$EncodingType != 'UTF-8') { $strJSON = iconv(QApplication::$EncodingType, 'UTF-8', $strJSON); // json must be UTF-8 encoded } print $strJSON; }