• Resolved Bob

    (@prasunsen)


    Lovely plugin!

    Is there any way to attach extra data to the ajax request which is sent when user answers?

    Basically we are trying to integrate h5p with a quiz plugin. The h5p shortcode is embedded in a quesiton which works great, but when user answers there is no way to know which question and quiz they are answering to – all we have is the h5p content ID which could be embedded in many quizzes and questions.

    Maybe you can give some idea? (I realize this may be impossible as I could not find it myself but maybe it’s something simple I’m overlooking)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author icc0rz

    (@icc0rz)

    Thank you for the kind words.

    I think it may be hard to do without modifying the plugin code. But one approach you could try is to use something like ajaxSetup to add the data you need.

    It depends a little on where you’d like to store the data as well and how to display it.
    Another option is to add some custom JavaScript that stores the results and then disabled the built-in results tracking:

    
    H5P.externalDispatcher.on('xAPI', function (event) { if (event.data.statement.result) { console.log('Post results', event.data.statement.result); } });
    

    If you find a way to modify the plugin that could benefit everyone you are welcome to try an create a pull request on GitHub.

    Thread Starter Bob

    (@prasunsen)

    Thanks for the feedback! I’ll see what we can do

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Attach data before the Ajax request?’ is closed to new replies.