Skip to content

Instantly share code, notes, and snippets.

@lbernstein
Created November 16, 2011 15:22
Show Gist options
  • Select an option

  • Save lbernstein/1370317 to your computer and use it in GitHub Desktop.

Select an option

Save lbernstein/1370317 to your computer and use it in GitHub Desktop.
<script>
var myCallback = function(data){
// A selection was made from the drop down
if(pick = data.pick) {
// Intentionally uses the assignment operator (=) instead of the equality operator (==) to
// check if data.pick is not null or undefined and assign it to a convenient local variable, company.
// Check if full firmographic data was returned by checking company_name.
// In this example we ignore if just registry info.
if(pick.company_name) {
var pk_companyname = pick.company_name;
var pk_industry = pick.industry;
var pk_subindustry = pick.sub_industry;
var pk_revenue_range = pick.revenue_range;
// More company info available if desired...
}
}
// An email was entered
if(person = data.person) {
// Set Person fields.
var pn_companyname = person.company_name;
var pn_industry = person.industry;
var pn_subindustry = person.sub_industry;
var pn_revenue_range = person.revenue_range;
// More company info available if desired...
}
// Match made based on typing in company field. Use when no pick object is available.
if(input_match = data.input_match) {
var im_companyname = input_match.company_name;
// More company info available if desired...
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment