Q:

Sending value, get nothing

I created ajax function which sends data to php file but something is wrong because when i die it, it holds nothing, and i know that my ajax function was written good. Here is how am i sending it: 
xmlhttp.send(dop);

And here is how i recieve it in php file:
$selectedLang = isset($_POST['dop']) ? $_POST['dop'] : '';

What am i doing wrong? I'am probably recieving info badly. Coz i can see that parameteres are good in ajax function. Please help, really need fast.
<script type="text/javascript">
    function run()
    {
        var dop = document.getElementById("kalba").value;
        return dop;
    }
    function insertData()
    {
        var dop = run();
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("POST","style/wps-light/datafile.php",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send("Reiksme=" + encodeURIComponent(dop));
    }
</script>

datafile.php:
<?php
$selectedLang = isset($_POST['dop']) ? $_POST['dop'] : '';
die("Viskas ok $selectedLang");

?>

A:

You need to get it like that:
$selectedLang = isset($_POST['Reiksme']) ? $_POST['Reiksme'] : '';

Because Reiksme is the key in $_POST array, not dop:
xmlhttp.send("Reiksme=" + encodeURIComponent(dop));
              ^^^^^^^

