Skip to content

Instantly share code, notes, and snippets.

@fischerbach
Last active December 20, 2020 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fischerbach/5c3a83f7e2077b98532205d1e8ccae74 to your computer and use it in GitHub Desktop.
Save fischerbach/5c3a83f7e2077b98532205d1e8ccae74 to your computer and use it in GitHub Desktop.
Survey.StylesManager.applyTheme("modern");
var surveyJSON = {
"pages": [{
"name": "page1",
"elements": [{
"type": "rating",
"name": "rate",
"title": "On a scale of one to five, how likely are you to recommend our website to a friend or colleague? *",
"minRateDescription": "(Most unlikely)",
"maxRateDescription": "(Most likely)"
}]
}]
}
function sendDataToServer(survey) {
//send Ajax request to your web server.
alert("The results are:" + JSON.stringify(survey.data));
}
var survey = new Survey.Model(surveyJSON);
$("#surveyContainer").Survey({
model: survey,
onComplete: sendDataToServer
});
@fischerbach
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment