<html><head>
        <title>Psychology Experiment - Thanks</title>
        <link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css">
        <link rel="stylesheet" href="/static/css/style.css" type="text/css">
        <script src="/static/lib/jquery-min.js" type="text/javascript"> </script>
        <script>
            function complete_amt_task() {
                $(window).on('beforeunload', function(){
                    return 'Your submission is in progress. Please do not close this window.';
                });
                $.ajax({
                    dataType: "json",
                    type: "GET",
                    url: "/worker_submitted?uniqueId={{ workerid }}:{{ assignmentid }}",
                    success: function (data) {
                        $( "#mturk_form" ).submit();
                        $(window).off('beforeunload');
                    }
                });
            };
        </script>
    </head>
    <body>
        <div id="container-not-an-ad">
            <div class="well">
                <h1>Thanks for your participation</h1>
                <hr>

                <p>To complete the HIT, simply press the button below.</p>

                {% if using_sandbox %}
                    <form style="width: auto;" id="mturk_form" action="https://workersandbox.mturk.com/mturk/externalSubmit" method="post">
                {% else %}
                    <form style="width: auto;" id="mturk_form" action="https://www.mturk.com/mturk/externalSubmit" method="post">
                {% endif %}
                        <input type="hidden" id="assignmentId" name="assignmentId" value="{{ assignmentid }}"> 
                        <input type="hidden" id="hitId" name="hitId" value="{{ hitid }}"> 
                        <input type="hidden" id="workerId" name="workerId" value="{{ workerid }}"> 
                    </form>

                    <button class="btn btn-success btn-lg" onclick="complete_amt_task();">
                        Complete HIT
                    </button>

                </div>

    </div></body></html>
