I'm trying to access the post api and I'm getting an access error not allowed, follow the error screenshot:
Failed to load http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx/CalcPrecoPrazo: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://site.com' is therefore not allowed access.
And the code that does ajax:
var params = {
'nCdEmpresa': '',
'sDsSenha': '',
'nCdServico': '04014',
'sCepOrigem': '03638010',
'sCepDestino': '43810040',
'nVlPeso': '1',
'nCdFormato': '1',
'nVlComprimento': '16',
'nVlAltura': '5',
'nVlLargura': '15',
'nVlDiametro': '0',
'sCdMaoPropria': 'n',
'nVlValorDeclarado': '0',
'sCdAvisoRecebimento': 'n',
'StrRetorno': 'xml',
'nCdServico': '40010,41106'
};
$.ajax({
type: "POST",
url: "http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx/CalcPrecoPrazo",
data: params,
contentType: "text/xml; charset=utf-8",
dataType: "xml",
success: function (data) {
console.log(data);
}
});