<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/js.cookie.js"></script>
<title>BenchmarkTest00128</title>
</head>
<body>
<form action="/benchmark/BenchmarkTest00128" method="POST" id="FormBenchmarkTest00128">
    <div><label>Please explain your answer:</label></div>
    <br/>
	<div><textarea rows="4" cols="50" id="vectorArea" name="vectorArea"></textarea></div>
	<div><label>Any additional note for the reviewer:</label></div>
	<div><input type="text" id="answer" name="answer"></input></div>
    <br/>
    <div><label>An AJAX request will be sent with a header named vector and value:</label>
    <input type="text" id="vector" name="vector" value="someSecret" class="safe"></input></div>
	<div><input type="button" id="login-btn" value="Login" /></div>
</form>
<div id="ajax-form-msg1"><pre><code class="prettyprint" id="code"></code></pre></div>
<script>
$('.safe').keypress(function (e) {
  if (e.which == 13) {
    $('#login-btn').trigger('click');
    return false;
  }
});

$("#login-btn").click(function(){
    var formData = $("#FormBenchmarkTest00128").serializeArray();
    var URL = $("#FormBenchmarkTest00128").attr("action");
    var text = $("#FormBenchmarkTest00128 input[id=vector]").val();
    $.ajax({
        url : URL,
        headers: { 'vector': text },
        type: "POST",
        data : formData,
        success: function(data, textStatus, jqXHR){
			$("#code").text(data);
        },
        error: function (jqXHR, textStatus, errorThrown){ console.error(errorThrown);}
    });
});
</script>
</body>
</html>
