Skip to content

Instantly share code, notes, and snippets.

@natmegs
Created August 25, 2017 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natmegs/6693c1f12d98d8258b18103acd36151f to your computer and use it in GitHub Desktop.
Save natmegs/6693c1f12d98d8258b18103acd36151f to your computer and use it in GitHub Desktop.
HTML file used in express app.js example
<html>
<head>
<link href="assets/style.css" type="text/css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" ></script>
</head>
<body>
<h1>Jelly Filled Donut</h1>
<form method="POST" action="/person">
First name: <input type="text" id="firstname" name="firstname" /> <br />
Last name: <input type="text" id="lastname"
name="lastname" /> <br />
<input type="submit" value="Submit" />
</form>
<script>
$.ajax({
type: "POST",
url: "/personjson",
data: JSON.stringify({ firstname: 'Reese', lastname: 'Donut' }),
dataType: 'json',
contentType: 'application/json'
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment