Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- //if submit button is clicked
- $('#prices_frm2').submit(function () {
- document.getElementById('l_username').style.backgroundColor='white';
- document.getElementById('l_password1').style.backgroundColor='white';
- document.getElementById('l_password2').style.backgroundColor='white';
- document.getElementById('l_companyname').style.backgroundColor='white';
- document.getElementById('l_firstname').style.backgroundColor='white';
- document.getElementById('l_lastname').style.backgroundColor='white';
- document.getElementById('l_phone1').style.backgroundColor='white';
- document.getElementById('l_email1').style.backgroundColor='white';
- var data="username="+document.getElementById('l_username').value
- +"&password1="+document.getElementById('l_password1').value+"&password2="+document.getElementById
- ('l_password2').value+"&companyname="+document.getElementById('l_companyname').value
- +"&firstname="+document.getElementById('l_firstname').value+"&lastname="+document.getElementById
- ('l_lastname').value+"&phone1="+document.getElementById('l_phone1').value
- +"&email1="+document.getElementById('l_email1').value+"&lbl_accounts_nr="+document.getElementById
- ('basic_accounts').value+"&lbl_eaccounts_nr="+document.getElementById('enhanced_accounts').value
- +"&lbl_prepay_numeric="+document.getElementById('lbl_prepay_numeric').value
- +"&tcost="+document.getElementById('lbl_total_cost_val').value+"&lbl_app="+document.getElementById
- ('lbl_app').value+"&domain="+document.getElementById('domain').value;
- if ($.browser.msie && window.XDomainRequest) {
- // Use Microsoft XDR
- var xdr = new XDomainRequest();
- xdr.open("post", "http://branding.polarismail.com/signup/xml.php");
- xdr.send(data);
- xdr.onload = function () {
- //parse response as JSON
- var JSON = $.parseJSON(xdr.responseText);
- if (JSON == null || typeof (JSON) == 'undefined')
- {
- JSON = $.parseJSON(data.firstChild.textContent);
- }
- if (JSON.returncode==0) {
- document.getElementById('signupmessage').style.visibility='visible';
- document.getElementById('signupmessage').innerHTML='<div
- class="error">'+JSON.returntext+'</div>';
- document.getElementById(JSON.field).style.backgroundColor='#f9e5e5';
- document.getElementById(JSON.field).focus();
- }
- if (JSON.returncode==1) {
- document.dosignup.action=JSON.ppurl;
- document.forms['dosignup'].submit();
- }
- }
- } else {
- //start the ajax
- $.ajax({
- //this is the php file that processes the data and send mail
- url: "http://branding.polarismail.com/signup/xml.php",
- //url: "https://cp.emailarray.com/signup/xml.php",
- //GET method is used
- type: "POST",
- //pass the data
- data: data,
- dataType: "json",
- //Do not cache the page
- cache: false,
- async: false,
- crossDomain: true,
- //success
- error: function (xhr, v2, v3) {
- },
- success: function (djson, textStatus, xhr) {
- if (djson.returncode==0) {
- document.getElementById('signupmessage').style.visibility='visible';
- document.getElementById('signupmessage').innerHTML='<div
- class="error">'+djson.returntext+'</div>';
- document.getElementById(djson.field).style.backgroundColor='#f9e5e5';
- document.getElementById(djson.field).focus();
- }
- if (djson.returncode==1) {
- document.dosignup.action=djson.ppurl;
- document.forms['dosignup'].submit();
- }
- }
- });
- }
- //cancel the submit button default behaviours
- return false;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment