Rewrote the entire question because evidently it was too vague
I have HTML, this HTML needs to be processed by Javascript before I send it through E-mail.
In other words, I need to run Javascript on HTML during PHP runtime.
(Fake) example to illustrate my point:
<?
$html = run_js_html($input,'myscript.js');
mail('target@email.com','Subject',$html);
?>
$input contains the input HTML
myscript.js contains some JS functionality
run_js_html should be a function that runs the script on the html, and then returns the new HTML after javascript.
Is this possible? One way I thought maybe could work is do some kind of HttpRequest through PHP to a PHP file that includes the input HTML and runs the Javascript on it.
Step number 3, if you insist in using jQuery, has to be done on the client side unless you are using server-side JavaScript, which you’re not, judging from the PHP tag.
Your options are:
But do you really want to do this? Couldn’t you do something like this?
While judging a string’s length by the number of characters is not very reliable, it is an easy implementation. You can also compute the approximate length of the string by:
imagettfbbox().