Adobe ColdFusion 8

serialize

Description

Creates a WDDX packet for a passed WddxRecordset instance.

Syntax

object.serialize( rootobj )

Parameters

Parameter

Description

object

Instance name of the WddxSerializer object

rootobj

JavaScript data structure to serialize

Return value

Returns a serialized WDDX packet as a string if the function succeeds, or a null value if an error occurs.

Usage

Call this function to serialize the data in a WddxRecordset instance.

Example

This example shows a JavaScript function that you can call to serialize a WddxRecordset instance. It copies serialized data to a form field for display:

function serializeData(data, formField)
{
    wddxSerializer = new WddxSerializer();
    wddxPacket = wddxSerializer.serialize(data);
    if (wddxPacket != null)
    {
        formField.value = wddxPacket;
    }
    else
    {
        alert("Couldn't serialize data");
    }
}