Game Results on Home Page

We will try and answer Questions in this forum. If you are having any issues with iScore Baseball, this is probably the best place to start. You can also search historical posts here.
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Game Results on Home Page

Post by joburg61 » Mon May 07, 2012 9:19 am

Is there a way to use the API to place game results on the home page of an iscorebaseball.com/teamname site?
User avatar
FTMSupport
Site Admin
Posts: 13193
Joined: Sat Mar 28, 2009 7:25 pm

Re: Game Results on Home Page

Post by FTMSupport » Mon May 07, 2012 12:37 pm

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.
Check out the new iScore Baseball documentation page!
Includes videos and user manual.
http://iscoresports.com/baseball/training.php#docs
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Re: Game Results on Home Page

Post by joburg61 » Mon May 07, 2012 1:14 pm

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
User avatar
FTMSupport
Site Admin
Posts: 13193
Joined: Sat Mar 28, 2009 7:25 pm

Re: Game Results on Home Page

Post by FTMSupport » Mon May 07, 2012 1:33 pm

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.
Check out the new iScore Baseball documentation page!
Includes videos and user manual.
http://iscoresports.com/baseball/training.php#docs
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Re: Game Results on Home Page

Post by joburg61 » Wed May 09, 2012 6:01 am

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>
User avatar
FTMSupport
Site Admin
Posts: 13193
Joined: Sat Mar 28, 2009 7:25 pm

Re: Game Results on Home Page

Post by FTMSupport » Wed May 09, 2012 7:40 am

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.
Check out the new iScore Baseball documentation page!
Includes videos and user manual.
http://iscoresports.com/baseball/training.php#docs
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Re: Game Results on Home Page

Post by joburg61 » Wed May 09, 2012 8:18 am

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
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Re: Game Results on Home Page

Post by joburg61 » Wed May 09, 2012 10:16 am

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.
User avatar
FTMSupport
Site Admin
Posts: 13193
Joined: Sat Mar 28, 2009 7:25 pm

Re: Game Results on Home Page

Post by FTMSupport » Wed May 09, 2012 11:09 am

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;
Check out the new iScore Baseball documentation page!
Includes videos and user manual.
http://iscoresports.com/baseball/training.php#docs
joburg61
Posts: 6
Joined: Mon May 07, 2012 9:16 am

Re: Game Results on Home Page

Post by joburg61 » Wed May 09, 2012 2:04 pm

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
Post Reply