...

View Full Version : ajax send mail error



goughy000
03-19-2007, 07:03 PM
function GetXmlHttpObject(){

var objXMLHttp=null

if (window.XMLHttpRequest){

objXMLHttp=new XMLHttpRequest()

}else if (window.ActiveXObject){

objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")

}

return objXMLHttp

}

function sendmail(){
var xmlHttp

var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
var subject = document.getElementById('subject').value;
var message = document.getElementById('message').value;

name = escape(name);
subject = escape(subject);
message = escape(message);

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null){

alert ("Browser does not support HTTP Request")

return

}

var url="http://clawz.goughy000.com/mail.php?from="+email+"&subject="+subject+"&message=Name:"+name+"%20Message:"+message

url=url+"&sid="+Math.random()
alert(url)

xmlHttp.onreadystatechange=stateChangedmail

xmlHttp.open("GET",url,true)

xmlHttp.send(null)
}

function stateChangedmail() {

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){

document.getElementById("contentarea").innerHTML="Mail Sent, we will get back to you within 24 hours"

}

}

firefox is saying its got something to do with xmlHttp.open("GET",url,true)

Error: uncaught exception: Permission denied to call method XMLHttpRequest.open


Thanx in advance

A1ien51
03-20-2007, 01:41 AM
You can not call another domain with the request.

Eric

goughy000
03-20-2007, 11:50 PM
oo thanx, all fixed now

i made a local file for the AJAX to call and that localfile used php to run the remote file



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum