Answer the question
In order to leave comments, you need to log in
Why windows-1251 from decodeURI?
There is a link of the form:
I extract the text from it and send it as an argument to the VK API method:<a href=link&p=любой_текст>
VK.api('method', {name:decodeURIComponent($(this)[0].href.match(/p=(.+)/)[1])}, function(r){
console.log(r);
});
Answer the question
In order to leave comments, you need to log in
Damn, I found where the jamb is: it was necessary to replace the underscore with a space, then the text for some reason remains in UTF-8 and the method works. Here's the "obvious" solution.
The final result is a regular expression:
decodeURIComponent($(this)[0].href.match(/p=(.+)/)[1].replace(/_/g, ' '));
Why such a hassle with pulling out of exile?
your site and links.
First, replace this $(this)[0].href.match(/p=(.+)/)[1])
with a normal data-* attribute, try it, and see how it goes.
what is the secret method of the open api?
what are the parameters?
why decodeURI if you pull from the link, and not from the address bar.
Errors are also incomprehensible.
See on the Network how the data goes there, everything should become clear.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question