So I create text(php) editor and I want to execute PHP code without refreshing page.
Now I use cookies to transfer code from javascript(which grab editor content).
Then color box opens and PHP file write cookie content to file, which is included.
And there is question:
Is there any other way to transfer PHP code from javascipt to PHP? Or any other way to execute PHP code? I know there is a AJAX, but I want to transfer a larger data including special characters(“,’,],[,$ etc.), that occur in PHP.
Yes, I use it only on localhost for education purpose only 🙂
Sorry for my english, I hope you understand me.
AJAX is suitable for sending large amounts of code. Take a look at jQuery.post and jQuery.ajax. Special characters pass through POST-request unchanged.
Make sure you set php setting
magic_quotes_gpctooff, as this option tells PHP to escape any special character with backslash.