javascript - JSONP Callback - data arrives unescaped when using jQuery call -


An external API from within a domain

In my client html / js code, I am speaking to get json data . Other APIs run in a separate domain, so basically this does not allow me to use regular Ajax / Exhaust requests. The solution we agreed with the API vendor was that they had support of jsonp

so I'm sending a jsonp request as follows.

  $ .ajax ({url: "https://rest.somevendor.com/app/site/hosting/restlet.nl?script=204&deploy=1&cid=436& Type "jsonp", type: 'received', jsonp: "callback to", contentType: "application / json; charset = utf-8", processData: false, header: {"authorization" : "NLAuth nlauth_account = xxxxxxx, nlauth_email = YYYYY @ pppp-zzzz.com, nlauth_signature = FGrmr5fjd"}, success: function (data) {//console.log (data);}}}  

My callback is called with JSN data, but there is a problem. When I make the same call from a browser REST client, then I have a valid J. However, when I make the same call from my customer code, and I get the data back in my callback:

  function myCallBack (data) {jsonString = " "Try {jsonString = JSON.parse};} hold (mistake) {warning (err.message)}}  

Parsing function throws exceptions that avoid the character (") For some reason it seems that the given data gets released before my callback function is reached. Therefore, I can not parse the data, and face a problem. After the article "itemprop =" text ">

I finally ignored this problem, by implementing a proxy server that calls AJAX (Without applying COS ban restrictions), and my customer call is for this proxy.

Of course, my proxy has implemented to return the access-control-permission-original title to the client domain, for the purpose of this call.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -