Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ajax send mail error

    Code:
    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
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    You can not call another domain with the request.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •