Guest User

signup.js from polarismail.com - saved 2012-06-25 08:12 UTC

a guest
Jun 25th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.      
  3.     //if submit button is clicked
  4.     $('#prices_frm2').submit(function () {        
  5.          
  6.     document.getElementById('l_username').style.backgroundColor='white';
  7.     document.getElementById('l_password1').style.backgroundColor='white';
  8.     document.getElementById('l_password2').style.backgroundColor='white';
  9.     document.getElementById('l_companyname').style.backgroundColor='white';
  10.     document.getElementById('l_firstname').style.backgroundColor='white';
  11.     document.getElementById('l_lastname').style.backgroundColor='white';
  12.     document.getElementById('l_phone1').style.backgroundColor='white';
  13.     document.getElementById('l_email1').style.backgroundColor='white';
  14.  
  15.     var data="username="+document.getElementById('l_username').value
  16.  
  17. +"&password1="+document.getElementById('l_password1').value+"&password2="+document.getElementById
  18.  
  19. ('l_password2').value+"&companyname="+document.getElementById('l_companyname').value
  20.  
  21. +"&firstname="+document.getElementById('l_firstname').value+"&lastname="+document.getElementById
  22.  
  23. ('l_lastname').value+"&phone1="+document.getElementById('l_phone1').value
  24.  
  25. +"&email1="+document.getElementById('l_email1').value+"&lbl_accounts_nr="+document.getElementById
  26.  
  27. ('basic_accounts').value+"&lbl_eaccounts_nr="+document.getElementById('enhanced_accounts').value
  28.  
  29. +"&lbl_prepay_numeric="+document.getElementById('lbl_prepay_numeric').value
  30.  
  31. +"&tcost="+document.getElementById('lbl_total_cost_val').value+"&lbl_app="+document.getElementById
  32.  
  33. ('lbl_app').value+"&domain="+document.getElementById('domain').value;
  34.  
  35. if ($.browser.msie && window.XDomainRequest) {
  36.     // Use Microsoft XDR
  37.    var xdr = new XDomainRequest();
  38.    xdr.open("post", "http://branding.polarismail.com/signup/xml.php");
  39.    xdr.send(data);
  40.    xdr.onload = function () {
  41.     //parse response as JSON
  42.     var JSON = $.parseJSON(xdr.responseText);
  43.     if (JSON == null || typeof (JSON) == 'undefined')
  44.     {
  45.             JSON = $.parseJSON(data.firstChild.textContent);
  46.     }
  47.     if (JSON.returncode==0) {
  48.         document.getElementById('signupmessage').style.visibility='visible';
  49.                 document.getElementById('signupmessage').innerHTML='<div
  50.  
  51. class="error">'+JSON.returntext+'</div>';
  52.                 document.getElementById(JSON.field).style.backgroundColor='#f9e5e5';
  53.                 document.getElementById(JSON.field).focus();
  54.     }
  55.  
  56.     if (JSON.returncode==1) {
  57.         document.dosignup.action=JSON.ppurl;
  58.                 document.forms['dosignup'].submit();
  59.     }
  60.    }
  61. } else {
  62.         //start the ajax
  63.         $.ajax({
  64.             //this is the php file that processes the data and send mail
  65.             url: "http://branding.polarismail.com/signup/xml.php",
  66.         //url: "https://cp.emailarray.com/signup/xml.php",
  67.              
  68.             //GET method is used
  69.             type: "POST",
  70.  
  71.             //pass the data        
  72.             data: data,    
  73.              
  74.         dataType: "json",
  75.  
  76.             //Do not cache the page
  77.             cache: false,
  78.    
  79.         async: false,
  80.              
  81.         crossDomain: true,
  82.  
  83.             //success
  84.  
  85.             error: function (xhr, v2, v3) {
  86.             },
  87.  
  88.         success: function (djson, textStatus, xhr) {
  89.         if (djson.returncode==0) {
  90.             document.getElementById('signupmessage').style.visibility='visible';
  91.             document.getElementById('signupmessage').innerHTML='<div
  92.  
  93. class="error">'+djson.returntext+'</div>';
  94.             document.getElementById(djson.field).style.backgroundColor='#f9e5e5';
  95.             document.getElementById(djson.field).focus();
  96.         }      
  97.  
  98.         if (djson.returncode==1) {
  99.             document.dosignup.action=djson.ppurl;
  100.             document.forms['dosignup'].submit();
  101.         }
  102.             }
  103.  
  104.         });
  105. }
  106.          
  107.         //cancel the submit button default behaviours
  108.         return false;
  109.     });
  110. });
Advertisement
Add Comment
Please, Sign In to add comment