Mechanical Turk have changed how to submit external hits AGAIN…

After a lot of googling I came across my own post (!!) from back in April 2013 that offered a partial solution.

Mechanical Turk in research: the 3 day bug

It’s not perfect. After a clean up, eh voila, submission via a hidden form and javasript:

function studyCompleted() {
    var form = document.getElementById("hitForm");
    form.action = getUrlParameter('turkSubmitTo');
    document.getElementById("assignmentId").value=getUrlParameter('assignmentId');
    document.getElementById("hitId").value=getUrlParameter('hitId');
    document.getElementById("workerId").value=getUrlParameter('workerId');
    form.submit();
}
#http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : sParameterName[1];
        }
    }
};
<form target="_parent" id="hitForm" style="visibility:hidden" id=’hitForm’ method="POST">
    <input type="hidden" id="assignmentId" name="assignmentId">
    <input type="hidden" id="hitId" name="hitId" />
    <input type="hidden" id="workerId" name="workerId"  />
    <input type="hidden" name="mock" value="mock">
    <input type="submit" name="Submit" id="submitButton" value="submit" disabled="true">
</form>

 

Leave a Reply

Your email address will not be published. Required fields are marked *