Created
August 5, 2017 04:54
-
-
Save dave-kennedy/0de7d528f55ff3733b4a457218c8d6f3 to your computer and use it in GitHub Desktop.
API request builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<form> | |
<p> | |
<label> | |
URL: <input name="url"> | |
</label> | |
</p> | |
<p> | |
Headers: <input type="button" id="add-header" value="Add"> | |
</p> | |
<div id="headers"></div> | |
<p> | |
<input type="submit" value="Submit"> | |
</p> | |
</form> | |
<script> | |
(function () { | |
var addHeaderBtn = document.getElementById('add-header'), | |
headers = document.getElementById('headers'); | |
function addHeader() { | |
var row, key, value; | |
row = document.createElement('p'); | |
key = document.createElement('input'); | |
value = document.createElement('input'); | |
key.name = 'headerKeys[]'; | |
key.placeholder = 'Key'; | |
value.name = 'headerValues[]'; | |
value.placeholder = 'Value'; | |
row.appendChild(key); | |
row.appendChild(value); | |
headers.appendChild(row); | |
} | |
addHeaderBtn.addEventListener('click', addHeader); | |
}()); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment