hey there kirupa gang, i have little troubles with a simple site; here’s the diagram:
Contents are placed in a div thru ajax; it works perfectly and parses php right but here’s the catch, how do I use post and get with that div ?
I use a standard contact.php page:
-php checks if there’s anything in ‘post’ (and validates) and
-php displays a #mail sent# form if mailto() was success
or
-php displays a form to send a message which uses a ‘post’ action to itself (contact.php)
Here’s the catch:
Since I load contact.php in the div thru ajax/dhtml I can’t use standard ‘submit’ button or it refreshes the page with post but I have to use my ajax code. Now how do I transmit post ? (or get for that matter). It seems that my contact.php page gets its ‘post’ from the root (index.php)
have I lost everyone ?
I use the following xmlhttprequest:
function fetch(url, target) {
document.getElementById(target).innerHTML = ' Fetching data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req != undefined) {
req.onreadystatechange = function() {fetchDone(url, target);};
req.open("GET", url, true);
req.send("");
}
}
function fetchDone(url, target) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML = req.responseText;
} else {
document.getElementById(target).innerHTML="Page Error:
"+ req.status + "
" +req.statusText;
}
}
}
function loadthis(name, div) {
fetch(name,div);
return false;
}
thanks to anyone who attempts to understand me :pleased: