I want to create a autocomplete function, where I need data as source from a different website. Therefore I want to create as first step a Ajax Request which just returns me the JSon String (I think it is Json), when I visit the link manually. I experienced some errors because of the "Allow Origin" thing.
This is the Link where I get all the data from:
http://www.futhead.com/15/players/search/quick/?term=
In the end (after term=) I want to add the input of my autocomplete field later and this link returns my different results for this.
This is what I've tried after googling a lot, which alerts "Error":
$.ajax({
url:"http://www.futhead.com/15/players/search/quick/",
data: "term=Ibarbo",
dataType: 'jsonp', // Notice! JSONP <-- P (lowercase)
success:function(json){
// do stuff with json (in this case an array)
alert("Success");
},
error:function(){
alert("Error");
}
});
What I want:
I want to display the results of this page in my php file sorted by the attributes.
This is the result of "http://www.futhead.com/15/players/search/quick/?term=ibarbo":
[{"rating": 75, "club_image": "http://futhead.cursecdn.com/static/img/15/clubs/1842.png", "image": "http://futhead.cursecdn.com/static/img/15/players/204550.png", "revision_type": null, "workrates_short_string": "M/M", "xb_auction_average": null, "full_name": "V\u00edctor Ibarbo", "player_id": 204550, "id": 816, "nation_image": "http://futhead.cursecdn.com/static/img/15/nations/56.png", "pc_auction_average": null, "type": "15-player", "short_name": "V\u00edctor Ibarbo", "ps_auction_average": null, "club": 363, "nation": 12, "attr6": 78, "attr4": 80, "attr5": 39, "attr2": 71, "attr3": 66, "attr1": 91, "slug": "victor-ibarbo", "league": 1, "rare": true, "level": 0, "position": "ST"}]
Then I want to output:
Rating = 75
Club_image = http://futhead.cursecdn.com/static/img/15/players/204550.png
and so on.