viernes, 30 de diciembre de 2011

Passing values from PHP to javascript

Seen in stackoverflow:



What is the easiest way to encode a PHP string for output to a Javascript variable?

I have a PHP string which includes quotes and newlines. I need the contents of this string to be put into a Javascript variable.

Normally, I would just construct my Javascript in a PHP file, ala:

var myvar = "";


However, this doesn't work when $myVarValue contains quotes or newlines.



Expanding on someone else's answer:



This does require PHP 5.2.0 or greater.

Limpiar un Wordpress hackeado

 Check list para limpiar instancias de Wordpress que han sido hackeadas, y para prevenir hackeos. Para técnicos de sistemas con acceso SSH a...