fancybox to load on page load
HTML
<script src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script>
<link rel="stylesheet" href="http://fancyapps.com/fancybox/source/jquery.fancybox.css">
<script>
function emutripPost() {
var emutripUrl = 'http://www.emutrip.com/emutrip/agent/service/agentRegistration';
var xmlData = '<?xml version="1.0"?><ClientDetails Client="11971" EMailAddress="' + "[email protected]" + '" SiteID="013"></ClientDetails>';
var emutripWindow = window.open("", "emutripWindow"); // open a new blank window
if (typeof XDomainRequest != "undefined") {
// XDomainRequest for IE.
var xhr = new XDomainRequest();
xhr.open('POST', emutripUrl);
if (xhr) {
// Response handlers.
xhr.onload = function() {
emutripWindow.location.href = xhr.responseText; // open emutrip response (url) in already opened new blank window
};
xhr.onerror = function() {
emutripWindow.document.write(xhr.responseText);
};
xhr.send(xmlData);
}
} else {
$.ajax{
type: 'POST',
url: emutripUrl,
data: xmlData,
contentType: 'text/plain',
success: function(responseUrl, textStatus) {
emutripWindow.location.href = responseUrl;
},
error: function(xhr, textStatus, error) {
emutripWindow.document.write(xhr.responseText);
}
});
}
}
</script>