2013-10-16 106 views
0

如何在我的代码底部的第二个函数中追加名字输入到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> 

回答

0

您可以通过执行$("input[name='Customer_Name__2']").val()检索表单值,这样你就可以修改相关的行看起来像这样:

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