% xapi-data-statement-minimal epub % Tyler Mulligan % April 24, 2014
click to send a shared statement to the ADL LRS
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <script type="text/javascript" src="http://z2.vc/xapi/html5-data-attributes/js/xapiwrapper.min.js"></script> <script type="text/javascript"> $(function(){ // apply default LRS config ADL.XAPIWrapper.changeConfig({ "endpoint" : "https://lrs.adlnet.gov/xapi/", "user" : "ebook", "password" : "ebooklrs" }); $('#send-statement').click(function (e) { e.preventDefault(); // don't get crazy with the sizzle
var $el = $(this);
// get the xapi-statement from the data atrribute
var stmt = $el.attr('data-xapi-statement');
var xstmt = $.parseJSON(stmt);
ADL.XAPIWrapper.sendStatement(xstmt, function(resp, obj) {
$("#statement-response").html(resp.status + ": " + obj.id);
});
});
});
You can view the statement on the ADL LRS Statement Viewer