www.webdeveloper.com
Results 1 to 4 of 4

Thread: First AJAX attempt. Dumping form to email.

  1. #1
    Join Date
    Mar 2013
    Posts
    9

    First AJAX attempt. Dumping form to email.

    I have a javascript funcion:-

    Code:
    function emailXMLDoc(){
    	var xmlhttp;
    	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
    		xmlhttp=new XMLHttpRequest();
    	}
    	else{// code for IE6, IE5
    		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	xmlhttp.open("POST","ASP\PostEmail.php",true);
    	xmlhttp.setRequestHeader("submitteremail",document.forms[0].email.value,"adminemail","sales@yandina.com","subject","Pending Order");
    	var x=document.getElementById("PurchaseOrder");
    	var emailText = "PURCHASE ORDER PENDING";
    	for (var i=0;i<x.length;i++){
    		emailText += "\n"+x.elements[i].value;
                 }
    	xmlhttp.send(emailText);
    };
    A BUTTON on the site is intended to dump the form to email, then submit for credit card processing.

    Button on HTML is:-

    <IMG ONCLICK= "javascript:
    emailXMLDoc();CreditCard.submit();"
    SRC="graphics/CreditCard.jpg">

    It gets as far as the xmlhttp.send and the emailText is correct but I get an error on the xmlhttp.send(emailText);

    Error: NS_ERROR_DOM_BAD_URI: Access to restricted URI denied

    help?

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,105
    Sounds like your trying to make a cross domain AJAX connection?
    I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!

  3. #3
    Join Date
    Mar 2013
    Posts
    9
    Yes it would seem so but I only have one domain and everything is in the same HTML program except the email posting program which is in a sub directory. I'll try moving the PostEmail.php to the same directory.

  4. #4
    Join Date
    Mar 2013
    Posts
    9
    Oooo thank you, yes I was testing locally but the PostEmail.php program was located on my website. Apparently that is a nono.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles