如何在不刷新的情况下将表单输入附加到变量?

时间:2013-10-16 06:08:40

标签: javascript php html

如何在代码底部的第二个函数中将first name输入附加到searchA.php? 我需要在没有页面刷新的情况下这样做。

<form action='' method='post'>
<tr><td>Customer Last Name</td><td><input type="edit" name="Customer_Name__2b" value="" size="20" class='auto'></td></tr>
<tr><td>Customer First Name</td><td><input type="edit" name="Customer_Name__2" value="" size="20" class='auto2'></td></tr>
<tr><td>Address</td><td><input type="edit" name="Address__3" value="" size="20" class="autoA" ></td></tr>
<form/>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>    
<script type="text/javascript">
$(function() {

    //autocomplete
    $(".auto").autocomplete({
        source: "search.php",
        minLength: 1
    }); 



});

</script>

 <script type="text/javascript">
$(function() {

    //autocomplete
    $(".auto2").autocomplete({
        source: "searchF.php?fname=",  //how to auto populate a get parameter?
        minLength: 1
    });             

});
</script> 

</html>

1 个答案:

答案 0 :(得分:0)

您可以通过$("input[name='Customer_Name__2']").val()检索表单值,以便修改相关行,如下所示:

source: "searchF.php?fname="+escape($("input[name='Customer_Name__2']").val()),