MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/demo.imensosoftware.com/lp/contact_form.js
$(document).ready(function(){
    $( 'form[name="contact-form-imenso"]' ).find('textarea').on( 'keyup', function() {
        if($(this).val().length > 0){
            var error_html_name = $(this).attr('name')+'_error';
            $('.'+error_html_name).addClass('d-none');
        }
    });
    $( 'form[name="contact-form-imenso"]' ).find('input').on( 'keyup', function() {
        if($(this).val().length > 0){
            var error_html_name = $(this).attr('name')+'_error';
            $('.'+error_html_name).addClass('d-none');
        }
    });
    $('.loader').hide();
    $( 'form[name="contact-form-imenso"]' ).on( 'submit', function(event) {
        var this_form = $(this);
        event.preventDefault();
        $('.loader').show();
        var flagError = 0;
        reset();
        if (input.value.trim()) {
            if (iti.isValidNumber()) {
              company_phone_full = iti.getNumber();
              $('#company_phone_full').val(company_phone_full);
              $('#company_phone_error').html('');

            } else {
              $('.loader').hide();
              input.classList.add("error");
              const errorCode = iti.getValidationError();
              $('#company_phone_error').html(errorMap[errorCode]);
              $('#company_phone_error').removeClass('d-none');
              $('#company_phone_full').val('');
              flagError = 1;
            }
        }
        if(flagError == 0){
          
            grecaptcha.ready(function () {
                grecaptcha.execute('6LcOMP4mAAAAAGfEgSuFmoRaSHUwo8pPV8UFKOUj', {action: 'submit'}).then(function (token) {
                    
                    $('#g_recaptcha_response').val(token);
                    //$(this).find('button').attr('type','button');
                    
                    var form_data = this_form.serializeArray();
                    //console.log(form_data.first_name);
                    var new_data = {user_id:'1',new_name:'ggg'};
                    //console.log(new_data);
                    if(!this_form.find('.error_msg1').hasClass('d-none')){
                        this_form.find('.error_msg1').addClass('d-none');
                        this_form.find('.error_msg1').html('');
                    }
                    this_form.find('.error_msg1').addClass('d-none');
                    //form_data.push( { "name" : "action", "value" : 'CONTACT_form' } );
                    $.ajax({
                        url: '../contact_form_submit.php',
                        type : 'post',
                        dataType: 'json',
                        data : form_data,
                        success : function( response ) {
                          $('.loader').hide();
                            this_form.find('button').attr('type','submit');
                            if(response.status == 'error'){
                              //alert(22222);
                                if(response.first_name_error){
                                  //alert(response.first_name_error);
                                    this_form.find('.first_name_error').removeClass('d-none');
                                    this_form.find('.first_name_error').html(response.first_name_error);
                                }
                                if(response.last_name_error){
                                    this_form.find('.last_name_error').removeClass('d-none');
                                    this_form.find('.last_name_error').html(response.last_name_error);
                                }
                                if(response.company_email_error){
                                    this_form.find('.company_email_error').removeClass('d-none');
                                    this_form.find('.company_email_error').html(response.company_email_error);
                                }
                                if(response.company_name_error){
                                    this_form.find('.company_name_error').removeClass('d-none');
                                    this_form.find('.company_name_error').html(response.company_name_error);
                                }
                                if(response.company_phone_error){
                                    this_form.find('.company_phone_error').removeClass('d-none');
                                    this_form.find('.company_phone_error').html(response.company_phone_error);
                                }
                                
                                if(response.g_recaptcha_response_error){
                                    this_form.find('.g_recaptcha_response_error').removeClass('d-none');
                                    this_form.find('.g_recaptcha_response_error').html(response.g_recaptcha_response_error);
                                }
                                if(response.req_text_error){
                                    this_form.find('.req_text_error').removeClass('d-none');
                                    this_form.find('.req_text_error').html(response.req_text_error);
                                }
                                if(response.msg.length){
                                    this_form.find('.common_error').removeClass('d-none');
                                    this_form.find('.common_error').html(response.msg);
                                }
                            }
                            if(response.status == 'success'){
                              //alert(555);
                                var user_ip = this_form.find('#user_ip').val();
                                var country_code = this_form.find('#country_code').val();
                                var lead_from_page = this_form.find('#lead_from_page').val();
                                this_form.find('input').val('');
                                this_form.find('textarea').val('');
                                
                                this_form.find('#lead_from_page').val(lead_from_page);
                                this_form.find('#user_ip').val(user_ip);
                                this_form.find('#country_code').val(country_code);
                                this_form.find('#lead_from_page').val(lead_from_page);
                                window.location.href = response.redirect_to;
                            }
                        },
                        fail : function( err ) {
                            $('.loader').hide();
                            this_form.find('.common_error').removeClass('d-none');
                            this_form.find('.common_error').html(err);
                            this_form.find('button').attr('type','submit');
                        }
                    });
                });
            });
            
            return false;
        }
        
    });
});