F
fochie
Greetings,
I'm trying to send data to my server using xmlhttp POST. The data being
sent is actually an HTML page that is built with javascript in the
browser. The HTML code contains a small javascript function in the
<HEAD> section. I applied encodeURIComponent to the data prior to
sending it but anything between the <script> </script> tags does not
get sent. The tramsmitted data is cought by a Perl script on the
server, it handles the input as normal FORM data and writes the html
data sent to a file (with the javascript function missing). Maybe I
need to do something different related to encoding the chars for an
HTML comment (?)
Snippit of the HTML data I'm trying to send -
<HTML><HEAD><TITLE>/TITLE>
<script>
<!--
function popLink(popurl){
var options = "";
var width="500";
var height="500";
blah
}
//-->
</script>
</HEAD><BODY BGCOLOR=WHITE>
The entire HTML gets sent with everything between <script> and
</script> missing.
Any assistance/pointers are most appreciated.
Thanks !!
Steve
Here's the POST that's being issued -
xmlhttp.open("POST", 'http://myserver.com/cgi-bin/xmlStoreFile.pl',
true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
store_server_reply = xmlhttp.responseText;
}
else{
store_server_reply = 'ERROR';
}
}
xmlhttp.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send('file='+encodeURIComponent(fn)+'&type='+encodeURIComponent(ext)+'&data='+encodeURIComponent(data)+'&option='+encodeURIComponent(opt)+'&stripuserid='+encodeURIComponent(id));
I'm trying to send data to my server using xmlhttp POST. The data being
sent is actually an HTML page that is built with javascript in the
browser. The HTML code contains a small javascript function in the
<HEAD> section. I applied encodeURIComponent to the data prior to
sending it but anything between the <script> </script> tags does not
get sent. The tramsmitted data is cought by a Perl script on the
server, it handles the input as normal FORM data and writes the html
data sent to a file (with the javascript function missing). Maybe I
need to do something different related to encoding the chars for an
HTML comment (?)
Snippit of the HTML data I'm trying to send -
<HTML><HEAD><TITLE>/TITLE>
<script>
<!--
function popLink(popurl){
var options = "";
var width="500";
var height="500";
blah
}
//-->
</script>
</HEAD><BODY BGCOLOR=WHITE>
The entire HTML gets sent with everything between <script> and
</script> missing.
Any assistance/pointers are most appreciated.
Thanks !!
Steve
Here's the POST that's being issued -
xmlhttp.open("POST", 'http://myserver.com/cgi-bin/xmlStoreFile.pl',
true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
store_server_reply = xmlhttp.responseText;
}
else{
store_server_reply = 'ERROR';
}
}
xmlhttp.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send('file='+encodeURIComponent(fn)+'&type='+encodeURIComponent(ext)+'&data='+encodeURIComponent(data)+'&option='+encodeURIComponent(opt)+'&stripuserid='+encodeURIComponent(id));