SHARE
TWEET

Untitled

a guest Feb 16th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function _(id){
  2.     return document.getElementById(id);
  3. }
  4.  
  5. function creatApplication(param){
  6.     $('#submit-button').prop('disabled', true);
  7.     if(validation()){
  8.         var name = _("fname").value+" "+ _("lname").value;
  9.         var data = {
  10.             seriesName: _("seasonName").value,
  11.             username : name,
  12.             useremail: _("pemail").value,
  13.             userphone: _("mobile").value,
  14.             videolink: _("video-link").value,
  15.             department: _("department").value,
  16.             refcode: _("refcode").value,
  17.             form_key : _("form_token").value,
  18.             guard_key:_("form_permit").value,
  19.             service : "Application"
  20.         };
  21.         $("#overlay").fadeIn(300);
  22.         var myJson = JSON.stringify(data);
  23.         $.post(URL.applicationURL+param+"?action=ajax", myJson)
  24.         .done(function(response) {
  25.             successfunction(response);
  26.         })
  27.         .fail(function() {
  28.             $('#submit-button').prop('disabled', false);
  29.             $("#overlay").fadeOut(300);
  30.           _("statusapp").innerHTML ='We found a network issue, please check your connection';
  31.         });
  32.     }
  33. }
  34.  
  35. function validation(){
  36.     if (_("fname").value === "") {
  37.         _("statusapp").innerHTML ='Please enter First Name';
  38.         $('#submit-button').prop('disabled', false);
  39.         return false;
  40.     }else{
  41.         _("statusapp").innerHTML ='';
  42.     }
  43.     if (_("lname").value === "") {
  44.         _("statusapp").innerHTML ='Please enter Last Name';
  45.         $('#submit-button').prop('disabled', false);
  46.         return false;
  47.     }else{
  48.         _("statusapp").innerHTML ='';
  49.     }
  50.     if (_("pemail").value === "") {
  51.         _("statusapp").innerHTML ='Please enter a valid Email';
  52.         $('#submit-button').prop('disabled', false);
  53.         return false;
  54.     }else{
  55.         _("statusapp").innerHTML ='';
  56.     }
  57.     if (_("mobile").value === "") {
  58.         _("statusapp").innerHTML ='Please enter Phone Number';
  59.         $('#submit-button').prop('disabled', false);
  60.         return false;
  61.     }else{
  62.         _("statusapp").innerHTML ='';
  63.     }
  64.     if (_("video-link").value === "") {
  65.         _("statusapp").innerHTML ='Please enter videolink';
  66.         $('#submit-button').prop('disabled', false);
  67.         return false;
  68.     }else{
  69.         _("statusapp").innerHTML ='';
  70.     }
  71.     if (_("department").value === "") {
  72.         _("statusapp").innerHTML ='Please select Act Type';
  73.         $('#submit-button').prop('disabled', false);
  74.         return false;
  75.     }else{
  76.         _("statusapp").innerHTML ='';
  77.     }
  78.     return true;
  79. }
  80.  
  81. function successfunction(responseText){
  82.     obj = JSON.parse(responseText);
  83.     if (obj.Status === 'Success' && obj.Data && obj.Message === 'CHECKOUTENCRYPT') {
  84.         _("customname").value = obj.Data;
  85.         $("#overlay").fadeOut(300);
  86.         $('#applicationform').modal('show');
  87.     }else{
  88.         $('#submit-button').prop('disabled', false);
  89.         $("#overlay").fadeOut(300);        
  90.         _("statusapp").innerHTML ='Something went wrong, Please try again later';
  91.         setTimeout("location.reload(true);",1000);
  92.     }
  93. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top