Hi, It's getting a usual weekly posting habbit with my coding problems. I usually don't go into Ajax because I'm really not good at it but I have to following problem, I'd like to "Post" some values with Ajax/JS but it does not work.
function update_form(myForm) {
http_request = false;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
try {
http_request = new ActiveXObject("Msxm12.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Error create XMLHTTP instance');
return false;
}
theForm = document.getElementById('theform');
theStr = '';
for (i=0; i < theForm.elements.length; i++) {
ele = theForm.elements[i];
theStr += ele.name + ' : ' + ele.value + "n";
}
url = "administration_ajax.php?update=ajax_adm_centerboxes.php";
http_request.onreadystatechange = update_form2;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", theStr.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(theStr);
}
function update_form2() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
document.getElementById('status').innerHTML = http_request.responseText;
} else {
alert('Have problems loading new page');
}
}
}
Everything works fine, file is called like it should, but the "POST" data does not arrive. I've tried with "GET" and it arrives good, but i cannot use it, because the URL length might exceed. therefor I really need to find out how to get this to work, and am sure someone knows the answer out here on 9r.
» Share Your Twitter Names ... Last Reply: 1 month ago by jongos.
And here I am Have the account from some time now, but never bothered using it..
Anyway it took about 20 minutes to go through this list, so show me some love and follow me to..ok?
^-^