Hi,
I have a problem with dhtmlxAjax:
str="hidid_Paciente="+document.getElementById("hidid_Paciente").value;
str+="&mail="+encodeURIComponent(document.getElementById("txtmail").value);
str+="&asunto="+encodeURIComponent(document.getElementById("hidasuntoMail").value);
str+="&mensaje="+encodeURIComponent(document.getElementById("hidmotivoMail").value);
str+="&remitente="+encodeURIComponent(document.getElementById("hidremitenteMail").value);
dhtmlxAjax.get("http://www.other_domain/enviar_mail.php?"+str+"&etc="+new Date().getTime(),outputResponseMAIL);
enviar_mail.php:
<? if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml"); } else {
header("Content-type: text/xml");
}
$mensaje=$_GET["mensaje"];
$to = $_GET["mail"];
$titu = $_GET["asunto"];
$from = $_GET["remitente"];
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8 \n";
$headers .= "From: ".$from."\n";
$headers .= "Reply-To: <".$to."> \n";
$ok = mail($to, $titu, $mensaje, $headers);
echo("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
if($ok){
$xml = "<api>\n";
$xml .= "<result>OK</result>\n";
$xml .= "</api>\n";
echo $xml;
} else {
$xml = "<api>\n";
$xml .= "<result>ERROR</result>\n";
$xml .= "</api>\n";
echo $xml;
}
?>
and the xml result is null:
function outputResponseMAIL(loader){
alert(loader.xmlDoc.responseXML)
}
if i open the enviar_mail.php with window.open I see the ok xml result but with dhtmlxAjax.get the xml returns null.
Why?
Thanks.