I'm sending a variable from a form using AJAX and this variable is proccess and sends to a PHP file that makes a MySQL query. The value of the input text is setting when I click in a row of one table. When I click the button to send the variable it returns the result of the mysql query. Well, if I click one more time in the button when the value of the input is other the query isn't modify, it returns me the first query. I need to refresh that query and I think that it's possible if I clear the variable. I put here the code of all. Thanks.
HTML Code
<td><input type="hidden" id="prueba" name="prueba"/></td>
<script type="text/javascript">
    var valor=document.getElementById("prueba").value;
</script>
<td><input type="button" name="ver" onclick="load(valor)" value="Ver linea seleccionada"/></td>
AJAX code
function load(str)
{
    var xmlhttp;
    if (window.XMLHttpRequest){
        xmlhttp=new XMLHttpRequest();
    }
    else{
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("mus").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("POST","mostralle.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.send("q="+str);
}
PHP Code (mostralle.php)
include"conexion.php";
$q=$_POST['q'];
mysql_connect($servidor, $usuario, $clave)or die (mysql_errno().mysql_error());
mysql_select_db($basedatos)or die (mysql_errno().mysql_error());
$result=mysql_query("SELECT Serie, Numeroas, Numlinea, Codart, Cant, Descripcion, Precio, Tipoiva, Subtotal FROM PRESUP_D WHERE Serie='$q' OR Numeroas='$q'");
while($row=mysql_fetch_row($result)){
    echo "<tr>";
    for($i=0;$i<mysql_num_fields($result);$i++){
        echo "<td>$row[$i]</td>";
    }
    echo "</tr>";
}
mysql_close();
