Difference between revisions of "ATC/Current/SDK/serialize"

From Genesys Documentation
Jump to: navigation, search
(Published)
m (Text replacement - "Genesys Cloud" to "Genesys Cloud CX")
 
(8 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
|Standalone=No
 
|Standalone=No
 
|DisplayName=serialize
 
|DisplayName=serialize
|Platform=PureEngage, PureConnect, PureCloud
 
 
|TocName=serialize
 
|TocName=serialize
 +
|Context=Learn how to use the <tt>serialize</tt> method to submit serialized data from a form.
 +
|Dimension=UtilityMethods
 
|ComingSoon=No
 
|ComingSoon=No
|Context=Learn how to use the <tt>serialize</tt> method to submit serialized data from a form.
+
|Platform=PureConnect, GenesysCloud, GenesysEngage-cloud
 
|Section={{Section
 
|Section={{Section
 +
|alignment=Vertical
 +
|structuredtext={{NoteFormat|1=This article only applies to customers using {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_chats|display text=web chat}}. If you are a Genesys Cloud CX customer, we encourage you to use the new {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_messaging|display text=web messaging}} feature to replace web chat.|2=}}<br />
 +
|Status=No
 +
}}{{Section
 
|sectionHeading=serialize
 
|sectionHeading=serialize
|Type=Structured
 
 
|alignment=Vertical
 
|alignment=Vertical
|gif=No
+
|structuredtext=The <tt>serialize</tt> method creates a JSON object where the keys are the form elements names, and the value for each key is the value(s) of the corresponding form elements. This method is useful in scenarios such as submitting a form with AJAX, since submit cannot capture the form submission. Instead a record can be invoked passing the serialized form data as its last argument. The serialize method takes the following parameters:
|structuredtext=The <tt>serialize</tt> method creates a JSON object where the keys are the form elements names, and the value for each key is the value(s) of the corresponding form elements. This method is useful in scenarios such as submitting a form with AJAX, since submit won’t be able to capture the form submission, but instead a record can be invoked passing the serialized form data as its last argument. The serialize method takes the following parameters:
+
 
* A unique identifier of the HTML form element
+
*A unique identifier of the HTML form element
* An (optional) array with the names of the elements to be serialized
+
*An (optional) array with the names of the elements to serialize
* A callback function with the serialized form data into a JSON object
+
*A callback function with the serialized form data into a JSON object
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 21: Line 25:
 
});
 
});
 
</source>
 
</source>
|fullwidth=No
 
 
|Status=No
 
|Status=No
 
}}
 
}}
 
}}
 
}}

Latest revision as of 21:28, November 9, 2021

This topic is part of the manual Journey JavaScript SDK for version Current of Genesys Predictive Engagement.

Contents

Learn how to use the serialize method to submit serialized data from a form.

Important
This article only applies to customers using web chat. If you are a Genesys Cloud CX customer, we encourage you to use the new web messaging feature to replace web chat.

serialize

The serialize method creates a JSON object where the keys are the form elements names, and the value for each key is the value(s) of the corresponding form elements. This method is useful in scenarios such as submitting a form with AJAX, since submit cannot capture the form submission. Instead a record can be invoked passing the serialized form data as its last argument. The serialize method takes the following parameters:

  • A unique identifier of the HTML form element
  • An (optional) array with the names of the elements to serialize
  • A callback function with the serialized form data into a JSON object
ac('serialize', 'my-form', function(data) {
  console.log(data['contact-email']);
});
Retrieved from "https://all.docs.genesys.com/ATC/Current/SDK/serialize (2025-06-23 22:17:04)"
Comments or questions about this documentation? Contact us for support!