Ajax rejecting images in byte array

Asked

Viewed 47 times

1

I have a system made in Asp.Net, I use as a request source Ajax along with Jquery. I created a function that searches the images stored in the database, converts them to byte array (this via Asp.net). When fetching the files, it brings a Json with the information already converted into an Array byte. So far so good, it works perfectly if it is 1 or 2 photos. If the file brings 3 or more photos it searches the images, but when processing the data it rejects and gives error, I believe it is the size of the file. How can I solve this by having Ajax process the information in larger sizes ?

The section of the function is this:

function buscarFotos(idSelecionado) {
    var data;
    var value = {
        codigo: idSelecionado
    }

try {

    $.ajax({
        type: "POST",
        url: "././CONTROLE/VISTORIA/vistoria.aspx/buscarFotoAnaliseBycodigo",
        data: JSON.stringify(value),
        dataType: 'json',
        contentType: 'application/json;charset=utf-8',
        success: function (response) {

            if (response === "null") {

                alert("NENHUMA vistoria ENCONTRADA PARA OS PARÂMETROS INFORMADOS");
                return;
            }

            if (response.d === "null") {

                alert("NENHUMA vistoria ENCONTRADA PARA OS PARÂMETROS INFORMADOS");
                return;
            }

            data = response.d;

            data = $.parseJSON(data);

            if (data !== 0 && data !== "") {

                carregarFotosVeiculo(data.imagens);
            } else {

                throw new Error("OCORREU ALGUM PROBLEMA AO BUSCAR VISTORIAS.");
            }

        },
        error: function (response) {
            data = response.d;
            alert(data);

            throw new Error("OCORREU ALGUM PROBLEMA AO BUSCAR VISTORIAS.");

        }
    });

} catch (e) {

    alert(e);
}

}

Error:

mesaAnalise.js:721 Uncaught Error: SOME SEARCH PROBLEM OCCURRED SURVEYS. at Object.error (mesaAnalise.js:721) at u (jquery-3.3.1.min.js:2) at Object.fireWith [as rejectWith] (jquery-3.3.1.min.js:2) at k (jquery-3.3.1.min.js:2) at Xmlhttprequest. (jquery-3.3.1.min. js:2)

Remembering that if it is 1 or 2 photos the system does not give error. With 3 images or more it gives this error and does not load the data. How can I resolve this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.