Trying to get AJAX working in BBLog plugin - Better Battlelog Forums #55901

Post edited 1 x times, last by
Like the title said, I'm trying to get a AJAX call to work in BBLog.

I am unable to get this working. I tried $.getJSON and $.ajax but both seem to fail returning any information. Is there a, special, way to get this to work in BBLog? What call should I use?

Kudo's to the person to point me in the right direction.

This is the code:
var request = $.ajax({
cache: false,
url: "",
dataType: 'json',

request.done(function(data) {
for(var i in data) {
var playerdata = data[i];
var player =

Post edited 2 x times, last by
Ajax is Cross-Domain protected, as defined in the Same Origin Policy.
You'll never can make it working, except with JSON, as you do.

But you probably use it wrong.

Your PHP Script must return following things

1. Content-type: application/json or application/x-javascript
2. A callback of the data must be triggered, the name is in the $_GET["jsoncallback"] variable.

Example JS:
$.getJSON("myurl.php", function(data){

Example PHP for myurl.php:
header("content-type: application/x-javascript");
echo $_GET["jsoncallback"]."(".json_encode(array("foo", "bar").")";