I’m using PHP and an ajax command to take the entire HTML contents of an external web page (via the PHP file_get_contents() command) and passing that HTML into a javascript variable. Once I have the page’s HTML contents stored in a variable, can I use jQuery to interact with the contents of that variable, in the same way that jQuery normally interacts with the DOM? In this example, I am trying to search for the existence of certain HTML elements (<div> and <script> tags) with specific ID attributes. Can anyone suggest how I can accomplish this?
I’m using PHP and an ajax command to take the entire HTML contents of
Share
If I understand you correctly, you should be able to just pass the variable to the jQuery function and work accordingly.
A quick example with
.filter():