Q:

Post Javascript to PHP file?

So I have this problem.
I have the following form on my webpage:
  <form>
 <textarea rows="3" id="pasteText"> </textarea>
 <button class="btn btn-success btn-block" type="submit" id="paster" onclick="captureText();">Paste!</button>

And I have a JavaScript method to capture the text in the textarea here:
function captureText() {
var value = $("#pasteText").val();

//var sent = "../../lib/_add.php?data="+value;
$.post('../../lib/_add.php', {data: value});
}

I'm trying to send the value inside the textarea to the data in PHP (the add.php adds the data variable to my database).  What's the best way to go about it?  Everything I've tried so far hasn't worked.
Thanks!

A:

You don't need jQuery $.post to submit the form. A simple HTML form would do.
<form action="../../lib/_add.php" method="post">
<textarea rows="3" name="data" id="pasteText"></textarea>
<input class="btn btn-success btn-block" id="paster" type="submit" value="Paste!" />
</form>

