The 'postSurveyAnswer' command has the following interface:
// Send 2 answers to a survey called My survey. The questions are 'How old are you?' and 'What is your gender?' $netminers.push(['postSurveyAnswer', 'My survey', 'How old are you?', '35-44', 'What is your gender?', 'Male']); Try it
Example of use:
'postSurveyAnswer', survey name, question 1, answer 1, question 2, answer 2, ..., question n, answer n
Example of implementation:
// Send answer to Netminers from a form function sendAnswers(question) { var answers = []; var questions = $('.' + question).each(function (q) { var answer = []; $(this).find('p').each(function (i) { if (answer.length == 0) { answer.push($(this).text()); } $(this).find('input[type=radio]').each(function () { if (this.checked) { answer.push($(this).parent().text()); answers.push(answer[0], answer[1]); return false; } }); }); }); if (answers.length == 4) { $netminers.push.apply($netminers, [['postSurveyAnswer', 'My survey'].concat(answers)]); } else { alert('Please answer both questions!'); } } <p>An example of a survey/poll</p> <div> <div class="question"> <p>Question 1: How old are you?</p> <p><input type="radio" id="Radio1" name="q1"/><label for="q1c1">15-25</label></p> <p><input type="radio" id="Radio2" name="q1"/><label for="q1c2">25-34</label></p> <p><input type="radio" id="Radio3" name="q1"/><label for="q1c3">35-44</label></p> <p><input type="radio" id="Radio4" name="q1"/><label for="q1c4">45-</label></p> </div> <div class="question"> <p>Question 2: Whar is your gender?</p> <p><input type="radio" id="Radio5" name="q2"/><label for="q2c1">Male</label></p> <p><input type="radio" id="Radio6" name="q2"/><label for="q2c2">Female</label></p> </div> <input type="button" value="Send answer" onclick="sendAnswers('question')"/>