Server IP : 108.163.255.210 / Your IP : 18.191.205.110 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/grahnidhi/public/js/ |
Upload File : |
'use strict'; var stripe_public_key = jQuery('#stripe_public_key').val(); var stripe = Stripe(stripe_public_key); function registerElements(elements, exampleName) { var formClass = '.' + exampleName; var example = document.querySelector(formClass); var form = example.querySelector('form'); var resetButton = example.querySelector('a.reset'); var error = form.querySelector('.error'); var errorMessage = error.querySelector('.message'); function enableInputs() { Array.prototype.forEach.call( form.querySelectorAll( "input[type='text'], input[type='email'], input[type='tel']" ), function(input) { input.removeAttribute('disabled'); } ); } function disableInputs() { Array.prototype.forEach.call( form.querySelectorAll( "input[type='text'], input[type='email'], input[type='tel']" ), function(input) { input.setAttribute('disabled', 'true'); } ); } // Listen for errors from each Element, and show error messages in the UI. var savedErrors = {}; elements.forEach(function(element, idx) { element.on('change', function(event) { if (event.error) { error.classList.add('visible'); savedErrors[idx] = event.error.message; errorMessage.innerText = event.error.message; } else { savedErrors[idx] = null; // Loop over the saved errors and find the first one, if any. var nextError = Object.keys(savedErrors) .sort() .reduce(function(maybeFoundError, key) { return maybeFoundError || savedErrors[key]; }, null); if (nextError) { // Now that they've fixed the current error, show another one. errorMessage.innerText = nextError; } else { // The user fixed the last error; no more errors. error.classList.remove('visible'); } } }); }); // Listen on the form's 'submit' handler... form.addEventListener('submit', function(e) { e.preventDefault(); // Show a loading screen... example.classList.add('submitting'); // Disable all inputs. disableInputs(); // Gather additional customer data we may have collected in our form. var name = form.querySelector('#' + exampleName + '-name'); var address1 = form.querySelector('#' + exampleName + '-address'); var city = form.querySelector('#' + exampleName + '-city'); var state = form.querySelector('#' + exampleName + '-state'); var zip = form.querySelector('#' + exampleName + '-zip'); var additionalData = { name: name ? name.value : undefined, address_line1: address1 ? address1.value : undefined, address_city: city ? city.value : undefined, address_state: state ? state.value : undefined, address_zip: zip ? zip.value : undefined, }; // Use Stripe.js to create a token. We only need to pass in one Element // from the Element group in order to create a token. We can also pass // in the additional customer data we collected in our form. stripe.createToken(elements[0], additionalData).then(function(result) { // Stop loading! example.classList.remove('submitting'); if (result.token) { // If we received a token, show the token ID. // example.querySelector('.token').innerText = result.token.id; // example.classList.add('submitted'); console.log(result.token.id); //var token = striptePyament(result.token.id); example.classList.add('submitted'); //order token id and post form var token = result.token.id; jQuery('#update_cart_form').prepend('<input type="hidden" name="token" value="'+token+'">'); jQuery("#update_cart_form").submit(); } else { // Otherwise, un-disable inputs. enableInputs(); } }); }); resetButton.addEventListener('click', function(e) { e.preventDefault(); // Resetting the form (instead of setting the value to `''` for each input) // helps us clear webkit autofill styles. form.reset(); // Clear each Element. elements.forEach(function(element) { element.clear(); }); // Reset error state as well. error.classList.remove('visible'); // Resetting the form does not un-disable inputs, so we need to do it separately: enableInputs(); example.classList.remove('submitted'); }); }