Problems Processing Strings With JS

Last week I encounter a serious problem when trying to use Ajax (PHP/Javascript) to save and update information in MySQL database. The problem is that javascript doesn’t process strings as PHP and decode any string to ASCII format…

The best way around this problem is to use the escape() function.

The way to use this function is like a regular PHP function:

PHP function structure...

Javascript ESCAPE function:

var str;
str = escape(document.getElementById('somediv').innerHTML);

This way you can use any special HTML character and stays the way it’s suppose to.

For more info you can go here.

Hope this help any one…

Happy Coding

This entry was posted in Tutorials and tagged , , , , , by Rafael Vila. Bookmark the permalink.

About Rafael Vila

I'm a Son of God, Father of three extremely awesome sons, husband of my sweetie pie Estella. I work as a Graphic Designer and a Web Developer in a Texan Company called Stealth Products, Inc. I've been blessed with a beautiful family and a great community of Faith. I believe God is the only God, who sent his son Jesus who become our Saviour and Redeemer Christ. The mercy and compassion of God is my daily wonder.