0

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>

1 Answer 1

1

Function refresh load is having this line,

document.getElementById("frmmonthly").reset();

which is resetting your form values.

Sign up to request clarification or add additional context in comments.

4 Comments

If I want to return textbox value after it execute ajax code how can i return it?
i did not understood your comment please add details of what do you mean by "want to return textbox value"
Its totally different from above question. Right now i am doing a task on other page where i did serch engine optimization. In that when i type a letter i matches word in database and shows the result like google. but after that when i filter it, it removes all the data in that text box which i want to pass on other page. So that data i want to return.
The javascript which i used is as below... <script type="text/javascript"> $().ready(function() { $("#users").autocomplete("get_course_list2.php", { width: 260, matchContains: true, mustMatch: true, //minChars: 0, //multiple: true, //highlight: false, //multipleSeparator: ",", selectFirst: false }); $("#users").result(function(event, data, formatted) { //alert(val(data[0])); $("#txt_sid").val(data[1]); //alert(val(data[1])); }); }); </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.