如何更改ajax发布

I have read the forums and google but i just dont understand how to change my ajax GET query to POST. It would be great if someone could help me to achive it. Thank you!

Heres my code:

function ajax(query,parameters,progress_div,progress_txt,result_div) { 
            //  Sisend:
            //      0 or 1 | (main_error) error string OR (resdiv) result string

            var xmlhttp;

            if (progress_div) { progdiv = document.getElementById(progress_div); }
            if (result_div) { resdiv = document.getElementById(result_div); }

            if (progdiv) { progdiv.innerHTML = progress_txt; }

            // ajax
            if (window.XMLHttpRequest) {
                  xmlhttp=new XMLHttpRequest();
            }
            else {
                  xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
            }
            xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                    var response = xmlhttp.responseText;
                    var string = response.split("<?php echo $vs; ?>");

                    //kui päring oli ok
                    if (string[0] == '1' || string[0] == '0') {
                        if (progdiv) { progdiv.innerHTML = ''; }
                        if (resdiv) { resdiv.innerHTML = string[2]; }
                    }
                    else {
                        errdiv = document.getElementById('main_error');
                        if (string[0] == '0') { errdiv.innerHTML = string[2]; }
                        else { errdiv.innerHTML = string[0]+string[1]; }
                        progdiv.innerHTML = '';
                        errdiv.style.display = 'block';
                    }
                    if (string[0] == '1' && string[1] != '0') {
                        window.location.href = string[1];
                    }
                }
            }
            xmlhttp.open('GET','?leht=ajax&query='+query+'&parameters='+parameters,true);
            xmlhttp.send();
            return false;
        }

change the below line

xmlhttp.open('GET','?leht=ajax&query='+query+'&parameters='+parameters,true);

like this

var url = 'http://yoursite.com/yourfile.php?leht=ajax&query='+query+'&parameters='+parameters;
xmlhttp.open("GET", url, true); //GET method
xmlhttp.open("POST", url, true); //POST method

You have missed the filename in your line.

Jquery POST

$.ajax({ url: "yourfilename.php",

data: {leht: 'ajax',"query":query,"parameters":parameters},

type: 'post',

success: function(output) {
    //process the output

}

});