Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Soccer Classification

Hi there, hope someone could guide me or advice the best way what im looking to achieve. Im new in javascript and already learning some things. But there is a detail i dont have idea how could be done. So the problem is:

I need to create a classification board, where shows the points of the soccer teams, i could do this in php and mysq, but my idea is not having the trouble in updaing the results of the classifications board almost every week and there isnt much sense since whit javascript i could get values from id tags remotelly . The problem is that the website im trying to get that values are located in a table, and in this table each value information doesnt have a unique id, only classes that are all the same since is for styling, so my question is if it is possible to get a value of a specifi column from a table by his order and remotelly(other website).

To everybody have a better ideia of the classification board, the number of teams and information columns are fixed, the only thing that it changes are the points number and there order(1ยช, 2ยช, etc...).

Sorry for my english.


2 Answers

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi Mauro Bonucci

Yes, it's possible to extract data from table cells without IDs. jQuery provides a good way to do it. See Andrew Chalkley's new jQuery Basics course for more information on jQuery.

You can use regular CSS selector syntax to select the 3rd element in a group of elements. For example, to get to the 3rd cell in each row of a table you could write this


You can learn more about this method of selecting elements with jQuery at http://api.jquery.com/nth-of-type-selector/

The bigger problem you'll encounter is using JavaScript to get the data from the other web site. You'll have to use AJAX to make that happen, and web browsers usually forbid AJAX requests across domains -- this is called the "same origin" policy. Unless that other site has specifically provided a way to accessing that content either via an API or by setting Access-Control-Allow-Origin: * in the header of that server's HTTP response.

I have an AJAX Basics course coming next month.

Thanks Dave, i just started the jquery course. Thanks for the advice and cant wait for the new course "Ajax Basics". Cheers