0

I'm working on a website to display some details from another website. Specifically I have an element I wish to display. I can get the elements xpath or css path, and I'd like to use this to display the value of the element in HTML box on a unrelated website.

I'm rather new to this so my question is really this basic, I'm sure it's been asked before but I just don't know what search terms to use. I've looked up what I can but I'm unsure if what I have found can be used in a HTML box (I've tried and failed, but I'm unsure if that's an error on my part or the application of the wrong method).

XPath: //*[@id="box2-server-status"]/div[3]/div[1]/div[1]/img

CSS Path:

#box2-server-status > div.box2-content > div:nth-child(4) > div.server-status-indicator > img

Any help/link with guides welcome!

SaidbakR
  • 13,303
  • 20
  • 101
  • 195
FraserOfSmeg
  • 1,128
  • 2
  • 23
  • 41

1 Answers1

0

Take a look at this, if that is what can be of help to you..

I got this page..

https://mkdizajn.github.io/my-colors/

and I'm about to pull the title from this page:

http://mkdizajn.github.io/about/

If you open inspector on that page and enter this code in 'console' (of if I got time and add it there in the source ;)

var content; 
jQuery.ajax({ 
    url: 'https://mkdizajn.github.io/about/', 
    success: function(data){ 
         content = data;
         var body = jQuery( content ) ;
         alert( body.find('h1').text() ) ;
    } 
})

you will have to get content from second page in the form of alert.. .. take a note that page is from that same domain, that is very important

https://mkdizajn.github.io/my-colors/

hth, k

Kresimir Pendic
  • 3,597
  • 1
  • 21
  • 28