views:

67

answers:

3

page1 or page2 on same server.

page1:

<div id="id_div">
</div>

page2:

getid=id_div

I don't care in what programming language, but how to catch id from another page ?

A: 

You can do it with jquery :

$.get('http://example.org/page.html', function(data) {
  alert($(data).find('div:first').id)
});

For instance, if you want all the ids of the div elements in this page, you can do :

$.get('http://stackoverflow.com/questions/3388180/how-to-catch-id-from-another-page/3388188', function(data) {
  list = [];
  $(data).find('div').each(function(index, element) {
    list.push(element.id);
  });
  alert(list);
});
Dorian
very interesting, will try this, thank you
tors
Is this answer solve your question ? (because, like everybody, your question is ambigous).
Dorian
A: 

Pass the id_div parameter in ther url as query string.

http://www.someaddress.com?theid=id_div

anything after the ? is a query string. theid in the url above is the identifier and the bit after the = is the value. You can pass multiple values by using ampersands:

http://www.someaddress.com?theid=id_div&amp;theuser=user2032&amp;activated=1 

The you can use a server side language or javascript to do something with this on page2.

elduderino
A: 

HTTP is stateless. Use sessions.

stillstanding
That's about as useful as saying "Water is wet. Use a towel"
Marc B