Advertisement
Guest User

Cadastro Consumidor

a guest
Apr 25th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $("#btn-form").on('click', function () {
  2.  
  3.         error_username = false;
  4.         error_email = false;
  5.         error_password = false;
  6.         error_retype_password = false;
  7.         error_checkbox = false;
  8.         error_captcha = false;
  9.  
  10.         check_form_name();
  11.         check_form_email();
  12.         check_form_senha();
  13.         check_form_reSenha();
  14.         check_form_termo();
  15.         check_form_captcha();
  16.  
  17.         if (error_username == false && error_email == false && error_password == false && error_retype_password == false && error_checkbox == false && error_captcha == false) {
  18.            
  19.             var url = "https://portal.meuacerto.com.br/api/site/CadastrarConsumidor"
  20.             ShowLoadingIcon('btn-form');
  21.             $.post({
  22.                 url: url,
  23.                 type: "POST",
  24.                 crossDomain: true,
  25.                 data: {
  26.                     NomeRazaoSocial: $("#form_name").val(),
  27.                     Email: $("#form_email").val(),
  28.                     Senha: $("#form_senha").val(),
  29.                     ConfirmacaoSenha: $("#form_reSenha").val(),
  30.                     AceiteTermosUso: $("#form_checkbox").is(":checked")
  31.                 },
  32.                 success: function (data) {
  33.  
  34.                     // RD STATION
  35.                     $.ajax( {
  36.                         url: $.data(document.body, 'ajaxUrl' ),
  37.                         type: 'POST',
  38.                         cache: false,
  39.                         data: {
  40.                             action : 'send_to_rd',
  41.                             nome : $("#form_name").val(),
  42.                             email : $("#form_email").val(),
  43.                             rd_id : 'form-cadastro-home'
  44.                         }
  45.                     });
  46.  
  47.                     LimparCamposConsumidor();
  48.                     HideLoadingIcon('btn-form');
  49.                     result = JSON.parse(data);
  50.  
  51.                     if (result.CadastroEfetuado) {
  52.  
  53.                         $("#myModal").modal('show');
  54.                         $("#containerLogin").hide();
  55.                         $("#respostaCadastro").show();
  56.                         $("#respCad").html(result.MensagemSucesso);
  57.                     }
  58.                 }
  59.             });
  60.  
  61.         } else {
  62.            
  63.         }
  64.     });
  65.  
  66. });// Valida os campos do formulário de cadastro do CONSUMIDOR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement