![]() |
Javascript Output to txt file
How would I change the code below to output into a text or php file instead of the current DOM. I have to bring this calculated output into another file using PHP include because the final page cannot have javascript on it.
{document.write('<article itemscope itemtype="http://data-vocabulary.org/Review-aggregate"><div itemprop="itemreviewed">ABC 123 Company</div><div>Rated <span itemprop="rating" id="ratingV">' + average + '</span> out of 5 with <span itemprop="count" id="count">' + ct + '</span> Reviews.</div></article>');} |
Despite how you end up doing it – what you are doing is highly critical in terms of security. Anyone can manipulate the JavaScript that you will then gladly inject into your website.
I suggest you really think about this twice. |
AMEN!
Forget using JavaScript for this. Use PHP code. Any calculation you do in JS code can instead be done in PHP. And *VALIDATE* that the input from the browser that tells the PHP code what to do is legitimate. |
| All times are GMT +1. The time now is 10:59 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.