i have a slightly procedural problem,
I have a php based server.
Basically i send a string to the server php file ( server.php file), this php file, performs some operations on this string and will then return the new string.
I want to add some js to the server.php file, which will run a few jquery dom traversing functions on the string. The string is a DOM.
I know that this is not what js was designed for,, i know that its supposed to only run on the browser,, but is there a simple workaround that i can do?
the string would look like this:
<body>
<em>
heres a em and this works as well
</em>
<p>
here is another para and it works , BUT NOW LOOK AT THE NEXT LINE
<br>
where is this prepend,no prepend here, ladies and gentlement,,NADA.
</p>
<button onclick = "addtags()">here is the magic</button>
</body>
so i need to do some, stuff on this via php, and then some aditional tree traversing,, and i love the jquery functions for this,,
I;m using the .text() , .contains(), .before(), .after(), .attr(‘class’) functions from jquery,, and if anyone can suggest any alternatives, its fine with me.. Can all this be done in XPATH??? i have no idea.. for me jquery works perfect.
Would i need to create a new .html file from the string that i receive and somehow run the js on that??
Best Regards,
RIchard.
You cannot run js an php at the same time on the server. Theoretically it could be done, but not in the same execution flow.
You can do DOM processing in php.