Php 如何使用ajax在文本框中返回值?

Php 如何使用ajax在文本框中返回值?,php,ajax,Php,Ajax,当我选择下拉值时,它会给出价格,但会删除所有以前的值。 在ajax代码下执行后,如何返回产品名称和下拉列表值? 函数refresh\u load是一个ajax函数 enter code here <div class="product_sub"><input type="text" name="prod[]" id="prod0" size="30" class="input_box" onkeyup="autocomp()"/><input type="hidd

当我选择下拉值时,它会给出价格,但会删除所有以前的值。 在ajax代码下执行后,如何返回产品名称和下拉列表值? 函数refresh\u load是一个ajax函数

enter code here
 <div class="product_sub"><input type="text" name="prod[]" id="prod0" size="30" class="input_box" onkeyup="autocomp()"/><input type="hidden" name="txt_pid[]" id="txt_pid0" /></div>
            <div class="product_sub"><select name="price" id="price" class="input_box" onchange="refresh_load()"><option value="">Select</option>
            <option id="billing_price" value="Billing Price">Billing Price</option>
            <option id="selling_price" value="Selling Price">Selling Price</option></select></div>

 <script type="text/javascript">
    function refresh_load()     
{
 //alert('hi');
 var price=document.getElementById('price').value; 
 var prodid=document.getElementById('txt_pid0').value; 

 var xmlhttp;       
    if (window.XMLHttpRequest)
     {
        xmlhttp=new XMLHttpRequest();
     }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4 && xmlhttp.status==200)
            {   
                //alert(xmlhttp.responseText);
                //document.images['imgtrue1'].src="../images/"+xmlhttp.responseText.split("#t#")[0];
                document.getElementById("rate").value=xmlhttp.responseText;
            }
    }           
        //xmlhttp.open("GET","ref_cat_class.php?val="+val+"&val2="+val2,true);
        //alert(p);     
            xmlhttp.open("GET","refresh_page.php?price="+price+"&prodid="+prodid,true);
            xmlhttp.send();
            //alert('hiii');

               document.getElementById("frmmonthly").reset();           
}
</script>

函数刷新加载具有此行

document.getElementByIdfrmmonthly.reset


这是在重置表单值。

如果我想在执行ajax代码后返回textbox值,我如何返回它?我不理解您的评论,请添加您想要返回textbox值的详细信息这与上述问题完全不同。现在我正在做另一页上的一项任务,我在那里做了serch引擎优化。在这种情况下,当我键入一个字母时,我会匹配数据库中的word,并像google一样显示结果。但在这之后,当我过滤它时,它会删除文本框中我想传递到其他页面的所有数据。我想返回的数据。我使用的javascript如下…$。readyfunction{$users.autocompleteget\u course\u list2.php,{width:260,matchContains:true,mustMatch:true,//minChars:0,//multiple:true,//highlight:false,//multipleSeparator:,/selectFirst:false};$users.resultfunction事件,数据,格式化{//alertvaldata[0];$txt\u sid.valdata[1];//alertvaldata[1]; }; };