driveflexfuel
New Member
- Messages
- 159
- Reaction score
- 0
- Points
- 0
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 as
Ajax function
part of post.php from ajax function
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.
Thanks
Txtarea contains the following code
Code:
function reloadImage(){
img = document.getElementById("spam_image");
img.src = "form_actions/image_creation/image.php?" + Math.random();
}
when i view the code on the display page it comes up as
Code:
function reloadImage(){
img = document.getElementById("spam_image");
img.src = "form_actions/image_creation/image.php?" Math.random();
}
Ajax function
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
Code:
$test = $_SESSION['txtarea'];
echo $test;
If anyone has any ideas on how i can get this to work it would be a big help.
Thanks