CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Javascript Output to txt file (http://www.codingforums.com/showthread.php?t=286595)

ARCLite Studio 01-28-2013 07:41 PM

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>');}

Airblader 01-28-2013 07:44 PM

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.

Old Pedant 01-28-2013 08:15 PM

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.