aximbigfan
03-19-2008, 03:45 AM
Ok, I changed a bunch for things from my previous thread, but it still doesn't work.
This is almost exactly like the ample, code, which works.
It doesn't print an error message, it just prints "undefined" in the text box.
Anyone see any obvious mistakes?
var http = "";
function ajax()
{
var http = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
//RX
http.onreadystatechange = function()
{
if (http.readyState == 4)
{
if (http.status == 200)
{
http = http.responceText;
document.forms[0].txt_string.value = http;
}
else
{
alert("AJAX error!");
}
}
}
var nform = document.forms[0];
var str = "mode=" + nform['mode'].value;
str += "&txt_string=" + nform['txt_string'].value;
str += "&key=" + nform['key'].value;
str += "&find=" + nform['find'].value;
str += "&replace=" + nform['replace'].value;
str += "&gen=" + nform['gen'].value;
http.open("POST","index.php", true);
http.setRequestHeader("content-type","application/x-www-form-urlencoded");
http.send(str);
}
Chris
This is almost exactly like the ample, code, which works.
It doesn't print an error message, it just prints "undefined" in the text box.
Anyone see any obvious mistakes?
var http = "";
function ajax()
{
var http = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
//RX
http.onreadystatechange = function()
{
if (http.readyState == 4)
{
if (http.status == 200)
{
http = http.responceText;
document.forms[0].txt_string.value = http;
}
else
{
alert("AJAX error!");
}
}
}
var nform = document.forms[0];
var str = "mode=" + nform['mode'].value;
str += "&txt_string=" + nform['txt_string'].value;
str += "&key=" + nform['key'].value;
str += "&find=" + nform['find'].value;
str += "&replace=" + nform['replace'].value;
str += "&gen=" + nform['gen'].value;
http.open("POST","index.php", true);
http.setRequestHeader("content-type","application/x-www-form-urlencoded");
http.send(str);
}
Chris