well I try download a PDF, when I send data to my controller, it's receives null o zero

my json data is:

Datos = {"IdEmpresa": 2, "NombreEmpresa": "Bimbo", "RazonSocial": "Veta de pan", ....... "CveEstado": 5}

My javascript XMLHttpRequest:

function printFile(Datos, address, Message) {

    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open('GET', address, true);
    xmlhttp.responseType = 'blob';
    xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");

    xmlhttp.onload = function (e) {
        if (this.status == 200) {
            var blob = new Blob([this.response], { type: 'application/pdf' });
            var link = document.createElement('a');
            link.href = window.URL.createObjectURL(blob);
            link.download = "report.pdf";
            link.click();
        }
    }

    xmlhttp.send(JSON.stringify(Datos)); //Data with json
}

my controller and how receives:

enter image description here

help me please, what happened?, I convert data a json before send

Related posts

Recent Viewed