I have a textarea full of code that is submitted to a session variable through ajax and later echoed into a page to display the code. For some reason it is not echoing a + sign in the code and thus breaking my javascript. I have been pulling my hair out trying to figure this problem out im going to show my code and see if anyone here can see my error or what i need to do to fix it.
Txtarea contains the following code
when i view the code on the display page it comes up asCode:function reloadImage(){ img = document.getElementById("spam_image"); img.src = "form_actions/image_creation/image.php?" + Math.random(); }
Ajax functionCode:function reloadImage(){ img = document.getElementById("spam_image"); img.src = "form_actions/image_creation/image.php?" Math.random(); }
Code:function ajax(){ var txtarea=document.code_form.txtarea.value; var passData = 'txtarea='+ txtarea; var AJAX = null; if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject('Microsoft.XMLHTTP'); } if (AJAX==null) { alert('Your browser doesn\'t support AJAX.'); return false } else { AJAX.open('POST', 'post.php', true); AJAX.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); AJAX.onreadystatechange = function() { if (AJAX.readyState==4 || AJAX.readyState=='complete') { callback(AJAX.responseText, AJAX.status); } } AJAX.send(passData); } }";
part of post.php from ajax function
Code:if (isset($_POST['txtarea'])){$_SESSION['txtarea'] = $_POST['txtarea'];}
page where it shows the code
If anyone has any ideas on how i can get this to work it would be a big help.Code:$test = $_SESSION['txtarea']; echo $test;
Thanks


LinkBack URL
About LinkBacks
Reply With Quote
