Skip to content

Instantly share code, notes, and snippets.

@Downes
Created January 30, 2021 22:54
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 Downes/8a91548937e6cf4c6b98d3426f113a3e to your computer and use it in GitHub Desktop.
Save Downes/8a91548937e6cf4c6b98d3426f113a3e to your computer and use it in GitHub Desktop.
Remote Comment Form
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Remote Comment Example</title>
<link href="http://www.mooc.ca/cgi-bin/api.cgi" rel="webmention" />
</head>
<body>
<h1>Blog Post</h1>
<p>Here is the text of my blog post. Don't you juyst want to comment?</p>
<h2>Comment:</h2>
<form action='' name='myform' id="myform" method='POST'>
<input type='text' name='cars' placeholder="Your website" id="cars"> (URL for content submission on my own website)<br>
<input type='hidden' name='action' value="rcomment">
<input type='text' name='title' value='Blog Post'> (Auto-populated with the title of the post I'm commenting on)<br>
Hidden fields: 'author' and 'feed', auto-populated with the information about the post I'm cpommenting on (optional, but better)<br>
<input type='hidden' name='author' value='Stephen Downes'>
<input type='hidden' name='feed' value='MOOC.ca'>
<textarea rows=20 cols=100 name="description" placeholder="Enter comment here"></textarea><br>
<button action='submit'>Submit Comment</button>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
// Shorthand for $(document).ready();
$(function() {
$('#myform').submit(function(){
var car = $('#cars').val();
$(this).attr('action', car);
alert($(this).attr('action'));
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment