【发布时间】:2018-09-22 18:41:26
【问题描述】:
在沙盒环境中测试我的示例 MTurk 任务时,我不断遇到一些神秘问题。在请求者环境中,我通过将 HTML/JS 代码复制/粘贴到 Create > Edit Project > (2) Design Layout 下的“Source”文本框中来创建任务。
我能够在该页面上预览任务,并且它似乎工作正常。我还可以在 RequesterSandbox 中发布 HIT,这让我进入了这个页面:RequesterSandbox > Manage > Results
我还可以登录 WorkerSandbox,找到我的 HIT,然后完成它。但是,当我按下提交时,我被重定向到一个显示“正在加载下一个 HIT...”的页面,然后转到另一个页面,显示为 "Sorry, we couldn't find that page. Strange...the page you were looking for is not here. Let's go home and try again"
回到RequesterSandbox,根本没有HIT提交的证据,也找不到HIT结果。我怀疑它没有在 WorkerSandbox 中正确提交,但我不确定如何修复它。任何建议将不胜感激!!
这是我的示例任务的 HTML/javascript 代码:
// extract url parameters
var queryDict = {};
location.search.substr(1).split("&").forEach(function(item) {
queryDict[item.split("=")[0]] = item.split("=")[1]
})
// use extracted url parameters to populate form
$("#endForm").attr("action",queryDict["host"]);
$("#assignmentID").val(queryDict["assignmentId"]);
$("workerId").val(queryDict["workerId"]);
$("#hitId").val(queryDict["hitId"]);
// reveal submit button after radio button is selected
$('#question_buttons').change(function(){
var btnResponse = $("input[name='theseButtons']:checked").val();
if (btnResponse == "thisOne" || btnResponse == "thatOne") {
$("#endTask").removeClass("hidden");
}
})
// submit response
$("submitButton").click(function() {
$("#endForm").submit();
});
<!DOCTYPE html>
<html lang="en">
<head>
<title>MTurk HIT Test</title>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<form action="https://workersandbox.mturk.com/mturk/externalSubmit" id="endForm" method="post" name="endForm">
<input id="data" name="data" type="hidden" value="" />
<input id="assignmentId" name="assignmentId" type="hidden" value="{{ assignment_id }}" />
<input id="workerId" name="workerId" type="hidden" value="{{ workerId }}" />
<input id="hitId" name="hitId" type="hidden" value="{{ hitId }}" />
<div class="container">
<h3>Write something:</h3>
<br />
<textarea cols="50" name="answer" rows="2"></textarea>
</div>
<div class="container" id="question_text">
<h3>Select one of these options:</h3>
</div>
<div class="container" id="question_buttons">
<div class="radio-inline">
<label><input name="theseButtons" type="radio" value="thisOne" />this one</label>
</div>
<div class="radio-inline"><label>
<input name="theseButtons" type="radio" value="thatOne" />that one</label>
</div>
</div>
<div class="container hidden" id="endTask">
<h3>Submit form by clicking the button below:</h3>
<br />
<input id="submitButton" name="submitButton" type="submit" />
</div>
</form>
【问题讨论】:
标签: javascript html amazon-web-services mechanicalturk