# AS2 Crossdomain.xml and sendAndLoad

**URL:** <https://forum.kirupa.com/t/as2-crossdomain-xml-and-sendandload/301728>\
**Category:** flash\
**Created:** [December 14, 2009, 8:54pm UTC](https://forum.kirupa.com/t/as2-crossdomain-xml-and-sendandload/301728 "2009-12-14T20:54:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skeeziix](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@skeeziix](https://forum.kirupa.com/u/skeeziix)\
**Post date:** [December 14, 2009, 8:54pm UTC](https://forum.kirupa.com/t/as2-crossdomain-xml-and-sendandload/301728/1 "2009-12-14T20:54:58Z")

</div>

I have a flash form with input text fields. I am sending the data to a 3rd party server. I can send the information via getURL but I want to send the data \*without \*opening a browser window so I am utilizing sendAndLoad. It works great locally but not through a browser (tested in IE and Firefox). I have verified that all the variables and urls are in the correct case, I have tried both Post and Get, I have tried network and local… Ugh! I am losing my hair on this one please help asap!!! ![](http://forum.kirupa.com/uploads/kirupa/525/d5236136df0858f4.gif)

Here is the file - _click on the second image_…

[http://www.axonmediagroup.com/adimag…directbuy.html](http://www.axonmediagroup.com/adimages/DirectBuy/DirectBuy/directbuy.html)

Here is the code…

on (release) {  
if (first\_name.text.length == 0) {  
error.text = “\*\* First Name Required **";  
} else if (last\_name.text.length == 0) {  
error.text = " **Last Name Required**";  
} else if (address1.text.length == 0) {  
error.text = " **Address Required**";  
} else if (city.text.length == 0) {  
error.text = " **City Required**";  
} else if (state1.value == “”) {  
error.text = " **State Required**";  
} else if (postal\_code.text.length == 0) {  
error.text = " **Zip Required**";  
} else if (phone\_home.text.length == 0) {  
error.text = " **Phone Required**";  
} else if (email.text.length == 0) {  
error.text = "** Email Required \*\*”;  
} else {

```
	System.security.loadPolicyFile('https://app.leadconduit.com/crossdomain.xml');
			
	var myloadVars:LoadVars = new LoadVars();
		myloadVars.RName = 'AxonMedia';
		myloadVars.AdReferenceID = '944E5433-F8B5-44FF-8085-E4A1D0D844E9';
		myloadVars.ReferenceID = '040E5D57-3A1A-412D-A1F4-B45BD48AE791';
		myloadVars.SUBID = 1;
		myloadVars.xxNodeId = '050l0tjhd';
		myloadVars.xxTest = 'true';
		myloadVars.Country = 'USA';
		
		myloadVars.first_name = first_name.text;
		myloadVars.last_name = last_name.text;
		myloadVars.SpouseName = SpouseName.text;
		myloadVars.address1 = address1.text;
		myloadVars.city = city.text;
		myloadVars.state1 = state1.selectedItem.label;
		myloadVars.postal_code = postal_code.text;
		myloadVars.phone_home = phone_home.text;
		myloadVars.email = email.text;
	
	trace(myloadVars);
	
	myloadVars.sendAndLoad("https://app.leadconduit.com/v2/PostLeadAction?",myloadVars,"POST");

	myloadVars.onLoad = function(success:Boolean) {
		if (success) {
			error.text = "Thank you for contacting us!";
		} else {
			error.text = "Error connecting to server.";
		}
	}
}

```

}

Here is the code that works via browser…

on (release) {  
if (first\_name.text.length == 0) {  
error.text = “\*\* First Name Required **";  
} else if (last\_name.text.length == 0) {  
error.text = " **Last Name Required**";  
} else if (address1.text.length == 0) {  
error.text = " **Address Required**";  
} else if (city.text.length == 0) {  
error.text = " **City Required**";  
} else if (state1.value == “”) {  
error.text = " **State Required**";  
} else if (postal\_code.text.length == 0) {  
error.text = " **Zip Required**";  
} else if (phone\_home.text.length == 0) {  
error.text = " **Phone Required**";  
} else if (email.text.length == 0) {  
error.text = "** Email Required \*\*”;  
} else {

```
	System.security.loadPolicyFile('crossdomain.xml');
			
	var RName = 'AxonMedia';
	var AdReferenceID = '944E5433-F8B5-44FF-8085-E4A1D0D844E9';
	var ReferenceID = '040E5D57-3A1A-412D-A1F4-B45BD48AE791';
	var TimeFrame = 0;
	var SUBID = 1;
	var xxNodeId = '050l0tjha';
	var xxTest = 'true';
	var Country = 'USA';

	var first_name = first_name.text;
	var last_name = last_name.text;
	var SpouseName = SpouseName.text;
	var address1 = address1.text;
	var city = city.text;
	var state1 = state1.selectedItem.label;
	var postal_code = postal_code.text;
	var phone_home = phone_home.text;
	var email = email.text;

	
	getURL("https://app.leadconduit.com/v2/PostLeadAction?", "_blank", "GET");
	
	      
    error.text = "Thank you for your response!";
}

```

}
