summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
Diffstat (limited to 'itjs.class')
-rw-r--r--itjs.class6
1 files changed, 3 insertions, 3 deletions
diff --git a/itjs.class b/itjs.class
index 22c5730..f6da4cb 100644
--- a/itjs.class
+++ b/itjs.class
@@ -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(";