when i select dropdown value it gives me price but removes all previous value.
how to return product name and dropdown value after it execute below ajax code? function refresh_load is a ajax function.
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>
Function refresh load is having this line,
document.getElementById("frmmonthly").reset();
which is resetting your form values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.