哦,为什么$ .post函数

Some time now that I am struggling with this function. Here is an example:

HTML example code:

    <form method="POST">            
        <label>Input 1:</label><br/>
        <input type="text" name="Input1" id="Input1"/><br/>
        <input type="submit" name="Login" value="Login" id="Login"/>
    </form>

PHP example code (script.php):

    if(isset($_POST['Input1Php']))
    {   
        $Input1 = $_POST['Input1Php'];

        if($Input1 == "Random Condition")
        {
            echo "All good";
        }else
        {
            echo "Hell no!";
        }
    }

jQuery example code (I also tried with .submit(), doesn't change anything):

$('#Login').click(function()
{
    var Input1JS = $('#Input1 ').val();

    if("Something"=="Random Condition")
    {   
        $.post('script.php',{Input1Php:Input1JS},function(data)
        {
            if(data=="All good")
            {
                   Show me that
            }else
            {
                   Show me this
            }
        });
    }else
    {
        Just don't do anything
    }
}); 

This script works find with .keyup, etc but when I change it to click or submit, it just doesn't do anyhting. I don't understand why. Am I missing something? Does $.post just don't work with those events?

PS: Please, don't change the $.post to something else. My point is to understand how or if THIS function works with those events.

Having that your question lacks some information, it's possible that your page is posting back so it doesn't wait for $.post to return. Try changing

<input type="submit" name="Login" value="Login" id="Login"/>

to

<input type="button" name="Login" value="Login" id="Login"/>

and see what happens.

The browser usually has some default action for buttons. In this case, the post data will be submitted by traditional means. If you want to prevent this behavior, just add a return false; at the end of your click callback.