0
my request
url="http://algumip:algumaporta/dowPDFNF?cChave="+chave
$.ajax({
url: url,
dataType: 'jsonp',
success: function (data) {
console.log(JSON.stringify(data));
},
type: 'POST'
});
error that returns:
Uncaught SyntaxError: Unexpected token :
However, when I pass the url (generated by the variable url) directly on the server, I get the right return. See image the return:
What I need is to get this return to have the pdf download
{"pdf":"http:\\\\algumip\\download\\6a423e04e2c2dfd4a59f0001ec8bbf44b9a6a6d-nfe.pdf"}
I believe that is not the case, because I can reach the other domain, problem is in reading the return "date" in Success
– Danielle Arruda torres
The problem should be this JSON.stringify, gives a console.log to see how the date is coming.
– Maycon F. Castro
Places a Debugger inside the Success function. Success: Function (data) { Debugger console.log(JSON.stringify(data); } To see if you are logging into Success.
– Maycon F. Castro
@Daniellearrudatorres Fact, change the title because in this case there is no relationship with CORS and the fact that the requirement is for another domain.
– Leandro Angelo
@Daniellearrudatorres you cannot do a jsonp post for another domain, the request cannot be get?
– Leandro Angelo
@Mayconf.Castro the Debugger returns me "Uncaught Syntaxerror: Unexpected Identifier"
– Danielle Arruda torres
@Leandroangelo I’ll switch to Get and test
– Danielle Arruda torres
Does not inform which callback.
– Danielle Arruda torres
The return treatment is also different, implement jsonpCallback to analyze the return.
– Leandro Angelo
Even with jsonp: "jsonpcallback", dataType: "jsonp". I still have the error return : Uncaught Syntaxerror: Unexpected token :
– Danielle Arruda torres
Let’s go continue this discussion in chat.
– Danielle Arruda torres