Utherr12 Posted December 10, 2010 Share Posted December 10, 2010 I want to know if it's possible to load information like getElementById('id').value from an element found on another document (not on the current one).Or if it's not, could it be done with php ? For example the target document has a fixed number of div's whose id has the form "quote_#" , i want to get the # from that div's id and store it in a array then get a random element from it... then display the innerHTML of a parent element 'p' with the class "quote_body". I want to get random info's from an external web-site, but i don't want to store the information from there, i just want to read it. I will be just loading the document once, then scan for every div with that id. Link to comment Share on other sites More sharing options...
Synook Posted December 10, 2010 Share Posted December 10, 2010 You can load other documents from the same domain using AJAX, but not from external sites. To do that you would need to use a server-side language, either to fetch the page verbatim and send it on, proxy-style, or to extract the wanted information and just use that. Once you have the page you can read the XMLHttpRequest.responseXML property to get a DOM object of the document. Link to comment Share on other sites More sharing options...
Utherr12 Posted February 11, 2011 Author Share Posted February 11, 2011 I found a way to do this and it's pretty easy. I thought it's a good think to share this with other people.Download the respective web page, then with jquery's load method you can load parts of it by tag,id,class,etc: http://api.jquery.com/load/ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.