PHP Post Ajax ile çalışmıyor

0 Cevap php

I have a simple form:
<form id="formTest" name="formTest" action="" method="get">
<input id="txtPostcode" name="Postcode" type="text" class="txtBoxSmall" /> <input type="button" name="SubmitTheForm" id="btnSubmit" onClick="TestAjax()" value="submit" />
</form>

Benim Javascript kodu:

function TestAjax(){
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {

        }
    };
    xmlhttp.open("GET","autocomplete.php?value1=aaaaa&value2=fffff",true);
    xmlhttp.send();
}

Benim sorunum php dosya autocomplete.php i şöyle txtPostcode eleman erişemiyor ki:

$postcodetext = $_GET[Postcode];

But if i get rid of the javascript function in the submit button, and add action="autocomplete.php" to the form tag it will work, but then of course it is not ajaxed. Can someone tell me why I cant get any values from $_GET[Postcode] when ajaxing?? I know i can just pass the value of the txtPostcode in the URL, but i dont want to do it that way, is there something i can do so i can access the textbox via the $_GET[Postcode] call in php??

Teşekkürler.

0 Cevap