In my index.html there's a div that will be filled with some html content returned from an ajax request to another web page. I need to highlight some specific part of the loaded html content that is determined by xpath. Using the code in the solution found here it's returning a null node. Obviously when i try to use an xpath that is referred to the code from the ajax request as shown:
var node = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
it returns a null node.
I'm searching for something useful for replace "document" inside the function with the purpose of obtain a not null node referred to the code from ajax and not from the index.html that still contains the empty div.
The div i need to fill is this: 'div id="mainAreaContent"
/div' and here you can find what i want to insert (https://ideone.com/bseVSF), the path i'm using is /table/tr/td/table[1]/tr/td[2]/h3[2]/text()
.
The document
variable is the index.html that calls the js script.