Skip to content

Instantly share code, notes, and snippets.

@pkarl
Created September 7, 2010 14:35
Show Gist options
  • Save pkarl/568441 to your computer and use it in GitHub Desktop.
Save pkarl/568441 to your computer and use it in GitHub Desktop.
<div class='some-inline-input'>
<p>Please enter some text in this box, then submit it!</p>
<textarea id="posted_text"></textarea>
<a class="post-text" href="/post/to/this/url">submit text with a POST request</a>
</div>
<script>
$('.post-text').click(function() {
var target = $(this)
$.post({
url: target.attr('href'),
data: $('#posted_text'),
success: function(data) {
alert(data);
}
});
return false;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment