1
AJAX request does not work when on the server...locally works normal... Does anyone have any idea what it might be ?
function SalvarPedido() {
//Data
var data = $("#Data").val();
//Cliente
var cliente = $("#Cliente").val();
//Valor
var valor = $("#Valor").val();
var token = $('input[name="__RequestVerificationToken"]').val();
var tokenadr = $('form[action="/Pedido/Create"] input[name="__RequestVerificationToken"]').val();
var headers = {};
var headersadr = {};
headers['__RequestVerificationToken'] = token;
headersadr['__RequestVerificationToken'] = tokenadr;
//Gravar
var url = "/Pedido/Create";
$.ajax({
url: url
, type: "POST"
, datatype: "json"
, headers: headersadr
, data: { Id: 0, Data: data, Cliente: cliente, Valor: valor, __RequestVerificationToken: token }
, success: function (data) {
if (data.Resultado > 0) {
ListarItens(data.Resultado);
}
}
});
}
An error in the console? It could be CORS, in which case it should be an error in the console... This url
var url = "/Pedido/Create";
is correct? should not have the server address if it is an external request?– Sergio
but it does not reach nor arrow the values up there in the variables......
– Daniel
You can answer my 2 questions?
1:
some error on the console?2:
the url is correct?– Sergio
1 - No 2 - Yes
– Daniel
Now only the AJAX request is not working...
– Daniel