Ajax To PHP转换器从ajax获取值

i need help, here my code :

<html>
<head>
<script>
function showHint(str) {
    if (str.length == 0) { 
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById("txtHint").innerHTML = this.responseText;
            }
        };
        xmlhttp.open("GET", "getstok.php?secretkey=123&sku=" + str, true);
        xmlhttp.send();
    }
}
</script>
</head>
<body>
<p><b>Masukkan kode barang / SKU:</b></p>
<form> 
Kode Barang: <input type="text" onkeyup="showHint(this.value)">
</form>
<div id="txtHint"></span>
</body>
</html>

What I need is:

  1. I want to hide this "secretkey=123" so visitor cannot see my secret key

  2. when call "xmlhttp.send();" return the value and I want to convert it to php like example

    $getxmlhttp = xmlhttp.send();

  3. when I type something it will be call function, but when I press enter that refresh, how to disable the enter or what the best suggestion for me.

this is my site sample: http://stok.tk

for example type "YI 067"

1 : You can't. The browser (and so the visitor) can always know wich page is called with wich URL and parameters

2 : You can't do it like that. You need to get the value of your request into getstok.php with the super global variables $_GET['your var']

3 : It's reloading the page because it's sending your form. By default it send it to the same page. Just remove your <form>