Original Post
I can't seem to find what's wrong with this block of code but it doesn't post the data to my cBoxPost.php file.
<script language="javascript" type="text/javascript">
var cBoxForm = document.forms['cBoxForm'];
var gl_title = cBoxForm.cBoxTitle.value;
var gl_text = cBoxForm.cBoxText.value;
var queryStr = '?cboxData=' + escape(gl_text);
function testFunc(strIn)
{
}
function xmlhttpPost(strSubmit, strResultFunc) {
var xmlHttpReq = false;
// Mozilla/Safari
//if (window.XMLHttpRequest) {
//xmlHttpReq = new XMLHttpRequest();
//xmlHttpReq.overrideMimeType('text/xml');
//}
// IE
// else if (window.ActiveXObject) {
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
//}
xmlHttpReq.open('POST', "cBoxPost.php", true);
xmlHttpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
xmlHttpReq.onreadystatechange = function() {
if (xmlHttpReq.readyState == 4) {
eval(strResultFunc + '(xmlHttpReq.responseText;);');
}
}
xmlHttpReq.send(strSubmit);
}
function addContent()
{
xmlhttpPost(queryStr, testFunc());
}
</script>
</pre>
Another quick question, whne I get that code block working, do I still use in my cBoxPost.php the $_POST["myFieldName"] method to see the posted data? Thanks.</code></pre>