# Form Embedded Code - Pass values from form submission to external application

**URL:** <https://community.hubspot.com/t/form-embedded-code-pass-values-from-form-submission-to-external-application/28094>\
**Category:** APIs & Integrations\
**Tags:** developer-tools, sdk, forms, professional\
**Created:** [November 17, 2020, 1:04pm UTC](https://community.hubspot.com/t/form-embedded-code-pass-values-from-form-submission-to-external-application/28094 "2020-11-17T13:04:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jas133](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jas133/32/84083_2.png) [@jas133](https://community.hubspot.com/u/jas133)\
**Post date:** [November 17, 2020, 1:04pm UTC](https://community.hubspot.com/t/form-embedded-code-pass-values-from-form-submission-to-external-application/28094/1 "2020-11-17T13:04:31Z")

</div>

I am trying to pass the values from a HubSpot form submission to an external application using a simple script. Can anyone provide insight on the proper syntax? I am not a developer and am having some trouble with test submissions.

This basic script was applied to a different marketing automation tool before using HubSpot and it worked well. I have been adjusting the input value formats in bold with no luck.

\<!--[if lte IE 8]\>  
\<script charset=“utf-8” type=“text/javascript” src=“[//js.hsforms.net/forms/v2-legacy.js](https://js.hsforms.net/forms/v2-legacy.js)”\>\</script\>  
\<![endif]--\>  
\<script charset=“utf-8” type=“text/javascript” src=“[//js.hsforms.net/forms/v2.js](https://js.hsforms.net/forms/v2.js)”\>\</script\>  
\<script\>  
hbspt.forms.create({  
portalId: “000000”,  
formId: “000000000000000000000000”,  
**onFormSubmit: function($form) {**  
var root = {};  
var data = {};  
var type = “trial”;  
var attributes = {};  
var userName = **‘{{ contact.email }}’;**  
var firstName = **‘{{contact.firstname}}’;**  
var lastName = **‘{{contact.lastname}}’;**  
var role = **‘{{ contact.title }}’;**  
var phone = ' **{{ contact.phone }}';**  
attributes.userName = userName;  
attributes.firstName = firstName;  
attributes.lastName = lastName;  
attributes.role = role;  
attributes.phone = phone;  
data.type = type;  
data.attributes = attributes;  
root.data = data;var xmlhttp = new XMLHttpRequest();  
var theUrl = "[https://somwebsite](https://somwebsite);  
xmlhttp.open(“POST”, theUrl);  
xmlhttp.setRequestHeader(“Content-Type”, “application/json;charset=UTF-8”);  
xmlhttp.send(JSON.stringify(root));  
}  
});  
\</script\>

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 17, 2020, 7:52pm UTC](https://community.hubspot.com/t/form-embedded-code-pass-values-from-form-submission-to-external-application/28094/2 "2020-11-17T19:52:48Z")

</div>

Hey @jas133 ,

Looks like you are missing a **"** after **somwebsite**

---

<div class="post-metadata">

**Author:** ![jas133](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jas133/32/84083_2.png) [@jas133](https://community.hubspot.com/u/jas133)\
**Post date:** [November 19, 2020, 4:28pm UTC](https://community.hubspot.com/t/form-embedded-code-pass-values-from-form-submission-to-external-application/28094/3 "2020-11-19T16:28:20Z")

</div>

Thanks for the reponse. We were able to resolve the issue. In order to pass the values through, the syntax needs to be $form.find(‘input[name=“company”]’).val(); instead of the values I have listed in bold above.
