So, first things first. I am trying to communicate with the longpoll server VK from javascript. I do AXAJ request of type jsonp. An error occurs. Brought error: parseerror. The problem was on the surface: a longpoll of contact does not know how to jsonp. PS data from the server still come (in the browser packages they are). Data in json format, and since I send jsonp, the browser waits for a callback in response. So, the question is: is there any way to get this data out? PPS did so far through the server the whole thing, but I really want to organize on the client side.
1 answer
It's simple: you must use the format that supports the server.
If the server gives the data in the form of jsonp - use jsonp. Otherwise use json. No magic
If you are not allowed to use the API on the client side, then you will fail, no matter how hard you try.
- I'm kind of not autistic. Of course, I immediately tried to send to json, since the contact in json works. BUT I need a cross domain query. And json is not. And all attempts to finish the crossDomain: true and other parameters were unsuccessful. Browser security policy does not allow to make such a request. In response: No 'Access-Control-Allow-Origin' header is available on the requested resource .. - Platinum
- @Platinum updated the answer - Pavel Mayorov
- So the fact of the matter is that this is the standard API "for all" method. But it works in JSON. - Platinum
- @Platinum if he were "for everyone" - the right headers would be configured there. - Pavel Mayorov
- Most clients work with longpoll. - Platinum
|