0

I want to create a html page that get data from a website table (not a database table -html one)

The code looks sorda like this: http://jsfiddle.net/wpVtc/

I tried to use jQuery ".find" but I couldn't get it to work.

It dosn't have ANY classes of id's . Then, when I get the data I want to display only that.

Thank u!

~Stephan

EDIT: The data is always going to be at the same place and it as always going to end with either 'GB' or 'MB'.

Stephan
  • 5
  • 4
  • Can you expect the data to have some value? Is the data always in the same location in the table, column and row? if there are no classes or identifiers and the data is random and is located in a random location in the table, there is no way you can 100% accurately find it. – jakee Jun 25 '12 at 10:16

1 Answers1

0

If the data is always in the same position you could use .eq(n).

So if you example is:

<table>
<tr>
    <tr> <--- i assume this is wrong
        <td>
            <table>
                <tr>...</tr>
                <tr>...</tr>
                <tr>...</tr>
                <tr>...</tr>
                <tr>...</tr>
                <tr>DATA I WANT</tr>

the selector would be:

"table tr td table tr:eq(6)"

See: http://api.jquery.com/eq-selector/


Another solution:

"table tr td table tr:contains(DATA I WANT)"

See: http://api.jquery.com/contains-selector/

Cranio
  • 9,647
  • 4
  • 35
  • 55
  • Thanks, the :contains works perfectly, but the problem now s that the data is on an external page and I want it to display on my page... – Stephan Jun 25 '12 at 10:32
  • You can not with Javascript alone, for security reasons, if by "external" page you mean on another domain. Cross-domain requests are subject to limitations. You should do this with some server-side program (like a PHP script). – Cranio Jun 25 '12 at 11:14
  • how about if i put it in an iframe? It's just gunna be a script that's gunna run on my pc, nothing on the internet. – Stephan Jun 25 '12 at 11:24
  • Sorry but I think it's still not possible: http://stackoverflow.com/questions/3083112/jquery-cross-domain-iframe-scripting For data scraping like this, on my local PC, I've always worked with Linux shell scripts or server-side script (from a local server on my pc). – Cranio Jun 25 '12 at 11:35
  • Thanks anyway. I know this might help someone else. – Stephan Jun 25 '12 at 11:40