请看一下我的代码。我正在尝试使用页面顶部附近设置的变量来设置演员。名称工作正常,但我无法让电子邮件工作。您能告诉我如何修改代码以使其识别电子邮件变量吗?现在它说'mailto:email',我知道这是错误的,它不起作用。但是,名称确实有效,所以我知道我很接近。谢谢你。
$("#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);
}