Sample JavaScript-only External Question HTML

Sample Code & Libraries>Sample JavaScript only External Question HTML
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

This is an example of HTML for an Amazon Mechanical Turk HIT externalquestion that uses JavaScript to perform the post-back to theMechanical Turk web server.


Submitted By: Craig@AWS
AWS Products Used: Other
Created On: December 14, 2006 7:15 PM GMT
Last Updated: May 31, 2007 6:58 PM GMT
An Amazon Mechanical Turk HIT can use an "external question," question data served from your own web server.  An external question appears inside a box in the worker's web browser.  When Mechanical Turk renders the box, it appends an assignmentId parameter to the URL of the external question web page if the worker is working on the HIT.  The web form on the page is responsible for including the assignmentId value in the data posted back to Mechanical Turk's web server by the form.

This example uses JavaScript to find the assignmentId in the URL and include it in the form's data.  This technique allows you to use an external question with a web server without server-side logic to insert the assignment ID.  For example, you might do this to host your external question with Amazon S3.

If no assignmentId is present, this example changes the display to inform the worker that the HIT is being previewed, and tells the worker to accept the HIT before submitting results.

Related Documents


This example didn't work
Even applying the bug fixes pointed out in the comments, it returns the following error message to the worker: There was a problem submitting your results for this HIT. This HIT is still assigned to you. To try this HIT again, click "HITs Assigned To You" in the navigation bar, then click "Continue work on this HIT" for the HIT. If this problem persists, you can contact the Requester for this HIT using the "Contact" link above. To return this HIT and continue working on other HITs, click the "Return HIT" button. Not only does this method provide no feedback on what went wrong, it is nearly impossible to debug. Don't waste your time on this.
Greg on August 6, 2010 6:47 PM GMT
Make sure you use https not http..
as the form submit URL. Using http url will only give you errors with no indication of what is wrong. Also, make sure you change the "name" attribute of the submit input variable to something other than "submit" as this is broken in firefox.
Jeff Wuschnakowski on March 26, 2009 10:05 PM GMT
In Sandbox, change the POST form action from "" to "" otherwise you'll get this error:
Ryan Mahoski on June 21, 2008 8:59 AM GMT
The above attachment HAS the code
You don't have to look very far to find the sample code. I would have given it a 5 if the sample code pointed you to information on making an external request.
rcfleischer on June 6, 2007 8:00 PM GMT
Where is the HTML?
I see the description but I see no JavaScript or HTML file here...
crazyhorsemike on April 14, 2007 6:59 PM GMT
We are temporarily not accepting new comments.
©2017, Amazon Web Services, Inc. or its affiliates. All rights reserved.