Please have a look at my code. I'm trying to set the actor with the variables set near the top of my page. Name works fine but I can't get email to work. Can you tell me how to modify the code so that it recognizes the email variable? Right now it says 'mailto:email' and I know that is wrong and it does not work. Name does work, however, so I know that I am close. Thank you.
$("#myButton").click(function(){
var name = $("#nameID").val();
var email = $("#emailID").val();
// Save the name in localStorage.
localStorage.setItem('name', name);
// Save the email in localStorage.
localStorage.setItem('email', email);
init();
document.location.replace("page2.html");
});
function init() {
var stmt = new ADL.XAPIStatement(
new ADL.XAPIStatement.Agent('mailto:email', name),
new ADL.XAPIStatement.Verb('http://adlnet.gov/expapi/verbs/completed', 'completed'),
new ADL.XAPIStatement.Activity('act:http://johnmenken.blogspot.com/2016/01/practice-sending-xapi-statements.html', 'Diamond in the Rough',
'Article on curation by Ben Betts and Allison Anderson.')
);
//generates a unique ID for the statement
stmt.generateId();
//Other contextual information about the Activity
stmt.addOtherContextActivity( new ADL.XAPIStatement.Activity('Category:Curation') );
//Registration: An instance of a learner experiencing a particular Activity.
stmt.generateRegistration();
ADL.XAPIWrapper.changeConfig({
'endpoint': 'https://lrs.adlnet.gov/xapi/',
'user': 'xapi-tools',
'password': 'xapi-tools',
'auth': 'xapi-tools'
});
ADL.XAPIWrapper.sendStatement(stmt);
}