Take data by url (string was not recognized datetime)

Asked

Viewed 45 times

0

I am passing an initial and final date per parameter (according to the image), as you can see in the localhost the bars (/) I am passing %20 and normally the generation of graphics occurs, but on the server is charging error 500 and when inspecting I see that you have the message "string was not recognized datetime". What may be happening since localhost works and server does not?inserir a descrição da imagem aqui

        function urldecode(str) {
        return decodeURIComponent((str + '').replace(/\+/g, '%20'));
    }

Here when loading page:

$(window).on('load', function () {
        var data = getParameterByName('data');
        var start = urldecode(getParameterByName('dataInicio'));
        var end = urldecode(getParameterByName('dataFinal'));

        DrawonLoad(start, end, "bottom", 300, "center", 10, data);
        buscaAtosPraticados();
        DrawonLoad2(start, end, "bottom", 300, "center", 10, data);
        buscaCertidoes();
        DrawonLoad3(start, end, "bottom", 300, "center", 10, data);
        buscaBalcaoCRT();
    });

Here where I call the ajax:

function DrawonLoad(dataInicio, dataFinal, posicaoLegenda, tamanho, alinhamento, tamanhoFonte, data) {
        $.ajax({
            type: 'GET',
            url: '/Home/FiltroData?dataInicio=' + urldecode(dataInicio) + '&dataFinal=' + urldecode(dataFinal) + '&data=' + data,
            success: function (chartsdata) {
  • its function should not be for Ncode instead of Code?

1 answer

0

So it didn’t need any of this above, it was just that the server was in English format. So I added it to the project (webconfig):

 <globalization culture="pt-BR" uiCulture="pt-BR" />

Browser other questions tagged

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