Question

I have big troubles dealing with a website I want to make a searchfunction for. It is a ranking in an online game, but the searchoptions are not enough for my alliance. Thus I want to make an ajax call getting the information needed, but there are several problems depending on what I tried:

  • If I try to make an ajax call as a JSONP-Call there's a "invalid label"-Error in my firebug. I already know that this error occurs because the retrieved data is not wrapped into a functioncall. Never the less I DO see the JSON data behind, why is it so far away for me?
  • If I try to make simple getJSON Calls using jQuery I get several errors all pointing at problems because of cross-site scripts. The JSON data is on another server, so that's a huge problem...

I personally am able to open the site directly correct (like www.onlinegamesite.com/api/?foo=foo&boo=false), if I'm able to open it in the browser, why am I unable to make it work pure programmatically?

I hope you have ideas how to deal with it, there are way too much threads about it in the WWW and after a day finding and trying again and again I finally hope for help in here.

EDIT: My current code is this one: (Trying for JSONP)

$(document).ready(function() {
var data = $.ajax({
    url: "http://lastchaos.gamigo.com/de/ranking/api/?tabNam=realm_4&CurrLang=de&CurrCategorie=user&sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength=1025&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true",
    dataType: "jsonp"
    });
});

My last try before was some simple JSON Call, but I was unable to debug it properly (Couldn't stop FF filtering XSS while IE has no proper debugtools):

$(document).ready(function() {
var data = $.getJSON({
    url: "http://lastchaos.gamigo.com/de/ranking/api/?tabNam=realm_4&CurrLang=de&CurrCategorie=user&sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength=1025&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true",
    type: "json"
    });
});
Was it helpful?

Solution

You can do this by using this option

  1. make a call to php page
  2. make a curl request to another site
  3. grab the curl output data
  4. return the output data to ajax
  5. use that output data in your code
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top