diff options
-rw-r--r-- | itjs.class | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -30,12 +30,12 @@ function send_headers() /** * Serialize the result into a javascript script * @param $values Array with values to be serialized - * @param $callback Javascript function to call with data (iframe solution) + * @param $envelope Encapsulate the data when callback function is provided (iframe solution) * @return String with javascript code to be sent to client */ -function serialize($values) +function serialize($values, $envelope = false) { - if ($callback = it::replace(array('[^\w.]' => ""), $_REQUEST['itjs_call'])) + if (($envelope || isset($values['eof'])) && ($callback = it::replace(array('[^\w.]' => ""), $_REQUEST['itjs_call']))) { $target = $_REQUEST['itjs_iframe'] ? "parent" : "window"; $header = "$target.it_loader && $target.$callback("; |