Home

HTML Forms

Hello There!!

How are you doing??
Please check out this link:

Link to Test Page

First name:

Phone:
Email:


function validateFormOnSubmit(theForm) {
let runScript = async() => {
try {
const data = await postData(‘https://https://api-us11.leadsquared.com/v2/LeadManagement.svc/Lead.Capture?accessKey=u$r434bdb823f23e72beb417347b3f8fac4&secretKey=8351ba3b9ce8e6d9c44cd624f33ef835976ab77’, [
{
“Attribute”: “FirstName”,
“Value”: document.getElementById(‘FirstName’).value
},
{
“Attribute”: “EmailAddress”,
“Value”:document.getElementById(‘EmailAddress’).value
},
{
“Attribute”: “Phone”,
“Value”:document.getElementById(‘Phone’).value
},
{
“Attribute”: “SearchBy”,
“Value”: “Phone”
}
]);
alert(JSON.stringify(data)); // JSON-string from `response.json()` call
} catch (error) {
alert(error)
}
}
runScript()
async function postData(url = ”, data = {}) {
// Default options are marked with *
const response = await fetch(url, {
method: ‘POST’, // *GET, POST, PUT, DELETE, etc.
mode: ‘cors’, // no-cors, *cors, same-origin
cache: ‘no-cache’, // *default, no-cache, reload, force-cache, only-if-cached
credentials: ‘same-origin’, // include, *same-origin, omit
headers: {
‘Content-Type’: ‘application/json’,
},
redirect: ‘follow’, // manual, *follow, error
referrer: ‘no-referrer’, // no-referrer, *client
body: JSON.stringify(data) // body data type must match “Content-Type” header
});
return await response.json(); // parses JSON response into native JavaScript objects
}
}

If you click the “Submit” button, the form-data will be sent to a page called “/action_page.php”.