Thursday, July 15, 2021

xhttp request

//Kirtishil Patil

var xhttp = new XMLHttpRequest();

xhttp.open("POST", "filename with complete path.php", true);

xhttp.onreadystatechange = function() {

    if (this.readyState == 4 && this.status == 200) {

        var res = this.responseText;

        var res_arry = JSON.parse(res);

        if (res_arry["result"] == 200) {

            //write here

        } else {

            //write here

        }

    }

};

var param = {//write param here};

xhttp.send(JSON.stringify(param));

No comments:

Post a Comment

Kirtishil Patil