Unless a submit button is explicitly pressed it's value won't be sent.
So in the case given, since there are no other form elements, nothing
with be posted to the server.

Karl Rudd

On Wed, Dec 24, 2008 at 11:36 PM, Brett Alton <brett.jr.al...@gmail.com> wrote:
>
> How do I get PHP to print JavaScript variables via $_POST? jQuery's
> $.post doesn't seem to be submitting any data.
>
> This is a sample of what I have...
>
> test.php:
> --------------
> <?php
>        echo '<pre>';
>        print_r($_POST);
>        echo '</pre';
> ?>
> <form method="post" action="test.php" id="test">
>        <input id="submit" name="submit" type="submit" value="Submit">
> </form>
> --------------
>
> jquery.js:
> --------------
> $(document).ready(function()
> {
>        $("form#test").bind('submit',(function(){
>                $.post("test.php",{
>                        // no matter what I put in here, nothing shows up in 
> test.php
>                });
>        });
> });
> --------------
>
> I've also tried:
>
> $("form#test").submit(function(){
>
> instead of bind...

Reply via email to