strange behavior for # sign
Posted: Sun Feb 22, 2009 9:10 pm
I created a form text area here
This is the javascript i'm using javascript prototype well you can care less about this
it's working 100% at this point
now this is the ajax_notes.php
Ok now when i submit the data like below
example 1
textarea: abcdefghijklmnopqrstu
1 alert: abcdefghijklmnopqrstu
2 alert: abcdefghijklmnopqrstu
example 2
textarea: abca###abc
1 alert: abca###abc
2 alert: abca
example 3
textarea: ###
1 alert: ###
2 alert:
now this is really strange behavior it seems the $_POST can't get the '#' string it delete the string that start with #
like example number 2
anyone ever get this problem
i don't know this is javascript problem or the php because on the 1st alert i still get the correct value even if it begin with ###
Code: Select all
<textarea id="notes"></textarea>
<input type="button" onclick="sendtext()" />
it's working 100% at this point
Code: Select all
function sendtext() {
alert($('notes').innerHTML); // the first alert the content of the notes before sending the data with ajax
new Ajax.Request ('ajax_notes.php',{
method: 'post',
parameters: 'v='+$('notes').innerHTML,
onComplete: function(resp) {
alert(resp.responseText) //It will alert the text on complete which is the text inside the text area
}
});
}
Code: Select all
print_r($_POST);
example 1
textarea: abcdefghijklmnopqrstu
1 alert: abcdefghijklmnopqrstu
2 alert: abcdefghijklmnopqrstu
example 2
textarea: abca###abc
1 alert: abca###abc
2 alert: abca
example 3
textarea: ###
1 alert: ###
2 alert:
now this is really strange behavior it seems the $_POST can't get the '#' string it delete the string that start with #
like example number 2
anyone ever get this problem
i don't know this is javascript problem or the php because on the 1st alert i still get the correct value even if it begin with ###