Page 1 of 2
Game Results on Home Page
Posted: Mon May 07, 2012 9:19 am
by joburg61
Is there a way to use the API to place game results on the home page of an iscorebaseball.com/teamname site?
Re: Game Results on Home Page
Posted: Mon May 07, 2012 12:37 pm
by FTMSupport
The API makes the data available for developers to do whatever they want with the data. If you write some kind of plug in that pulls the data through the API and displays it on a web page, you may be able to display it on your home page. We do not have any examples of doing this, but if you are a developer, it should be possible to do.
Re: Game Results on Home Page
Posted: Mon May 07, 2012 1:14 pm
by joburg61
I am a developer. Does the stock website have access to php? I'm suggesting accessing get from the Html editor or iframe in the editor? Also is there ftp access?
Thanks
Re: Game Results on Home Page
Posted: Mon May 07, 2012 1:33 pm
by FTMSupport
The team websites do not allow running your own PHP code on our servers, and you do not get FTP access. You can edit the home page through the HTML editor provided. If you need server side code to manipulate the data returned by the API, you would have to provide your own server to do so. If you can do what you are trying to do in javascript, then you should be able to make AJAX calls to the API to get the data and do it all with client code.
Re: Game Results on Home Page
Posted: Wed May 09, 2012 6:01 am
by joburg61
I've done what you had suggested, however, the script stops before getting to 'success'. Any thoughts. This code works fine with others.
Code: Select all
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "http://api.iscoresports.com/teamwebsite/cumulativestats.php?s=baseball&t=demobaseballteam&p=demopwd",
data: "json=1",
dataType: "json",
success: function(data) {
alert('Success!');
}
});
});
</script>
Re: Game Results on Home Page
Posted: Wed May 09, 2012 7:40 am
by FTMSupport
For data type try "jsonp". Having just "json" will run into cross site scripting issues. The format of the parameter in your data tag is also wrong. It should be {json:1} and you should probably move all the other parameter into the data attribute as well instead of mixing it in the querystring.
Re: Game Results on Home Page
Posted: Wed May 09, 2012 8:18 am
by joburg61
Thank-you!!! I was using jsonp as a datatype but I was getting an invalid label error, and here it was do to the data attribute. Thanks again.
Jerome
Re: Game Results on Home Page
Posted: Wed May 09, 2012 10:16 am
by joburg61
It seems though the datatype is jsonp and the data attribute is set to json:1 the result is XML and not js. And I'm not sure if that is why I would be having trouble getting to the specific attributes.
Re: Game Results on Home Page
Posted: Wed May 09, 2012 11:09 am
by FTMSupport
We can not start troubleshooting custom code, but here is a sample page that makes the JSONP call you are trying to make. You can use it as a reference:
http://api.iscorecentral.com/samplejson.html" onclick="window.open(this.href);return false;
Re: Game Results on Home Page
Posted: Wed May 09, 2012 2:04 pm
by joburg61
We never asked you , FTM specifically, to troubleshoot code. We posted our question in the iScore forum which we assumed other users help other users as in most support forums. FTM support team answered our initial question and subsequent questions, we did not have your arm twisted behind your back. By your last response we would then assume FTM is not interested in helping developers with Open Source plugins for their products. Good documentation is always helpful not just for the users and developers but to support staff as well. FTM, should learn from others.
Cheers,
Jerome