Answer the question
In order to leave comments, you need to log in
Getting a list of friends from Odnoklassniki
From the API docs ( apiok.ru/wiki/display/api/FAPI.init+ru ) you can see that you first need to initialize the API itself. But here a plug immediately arises: rParams is empty. What am I doing wrong?
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="//api.odnoklassniki.ru/js/fapi5.js"></script>
<script>
var rParams = FAPI.Util.getRequestParameters(); console.log(rParams);
FAPI.init(rParams["api_server"], rParams["apiconnection"],
function() { console.log('ok')},
function( error ) { console.log(error); }
);
</script>
</head>
<body>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
fapi5.js is intended for games that will be opened on Odnoklassniki itself ( like these ), so if you are just making an external application / site, then this library is not suitable for it.
Try replacing the line:
On the:
<script type="text/javascript" src="http://api.odnoklassniki.ru/js/fapi5.js" defer="defer"></script>
in general, the point is that GET parameters must contain all application parameters apiok.ru/wiki/pages/viewpage.action?pageId=42476523 (and all internal link transitions in the frame must contain them)
here is the code of the FAPI.Util function. getRequestParameters()
getRequestParameters: function() {
var l = new Array();
var g = window.location.search;
console.log(window.location.href);
if (g) {
g = g.substr(1);
var k = g.split("&");
for (var h = 0; h < k.length; h++) {
var e = k[h].split("=");
var f = e[0];
var m = e[1];
m = decodeURIComponent(m.replace(/\+/g, " "));
l[f] = m;
}
}
return l;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question