在jQuery中输入文本值

This Code note note working Please help. I try to know more about Jquery, Ajax Get & Post. Can use the code in PhoneGap App?

I use this tutorial - https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_post

<script>
$(document).ready(function(){
    $("button").click(function(){
    var a= $("#test1").val();
    var b= $("#test2").val();

        $.post("demo_test_post.asp",
        {
          name: a,
          city: b
        },
        function(data,status){
            alert("Data: " + data + "
Status: " + status);
        });
    });
});
</script>
 <p>F Name: <input type="text" id="test1" value="Mickey Mouse"></p>

<p>S Name: <input type="text" id="test2" value="Mickey Mouse"></p>


<button>Send an HTTP POST request to a page and get the result back</button>

But this change had worked

 var a= "FName";
    var b= "SName";