I can’t access controller

Asked

Viewed 35 times

-1

Good afternoon, I am having a great difficulty to access an api, via jquery the same always returns error 400 and sometimes 415 follows example: -- Jquery-- inserir a descrição da imagem aqui -- api controller -- inserir a descrição da imagem aqui ---Class-- inserir a descrição da imagem aqui

Thank you.

  • Somebody please.

  • Paste the code and not a print of your ide

1 answer

0


You do not need to mount a string with the Json of your date object, Jquery.Ajax expects a Plain Object as an attribute for this parameter...

function DescontoCasa(){
    var obj = { empresaId : 1 };

    $.ajax({
        type: "GET",
        url: "https://loclhost:44328/api/financeiro/RelDescontoCasa",
        data: obj,
        contentType: 'application/json'

    });
}

https://api.jquery.com/jquery.ajax/

  • Thank you very much.

  • @Jefferson, if the posting was the solution to the problem, check to accept as an answer. This will make both your question and the answer useful for other people facing the same problem. And if you like the solution presented, signal that it was useful with a positive vote

Browser other questions tagged

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