php - How to pass shortcode param value to Javascript/Ajax? -


i have created contact form shortcode process ajax. shortcode have parameter set email address in messages going sent. way can use differents email accounts receive messages depending on form is.

when clic submmit javascript take form fields value $('#name').val() , send ajax_contact_form function created in php file:

 $('.contact-form').submit(function(){     var action = $(this).attr('action');     $("#message").slideup(750,function() {     $('#message').hide();     $('#submit')       .after('<i class="fa fa-refresh fa-spin fa-2x"></i>')       .attr('disabled', 'disabled');     $.post(       action,       {         action: 'ajax_contact_form',         name: $('#name').val(),         email: $('#email').val(),         phone: $('#phone').val(),         subject: $('#subject').val(),         message: $('#message').val(),       },       function(data){         document.getelementbyid('form-alert').innerhtml = data;         $('#form-alert').slidedown('slow');         $('.contact-form .fa-spin').fadeout('fast',function(){$(this).remove()});         $('#submit').removeattr('disabled');         if(data.match('success') != null) $('.contact-form').slideup('slow');       }     );   });   return false;   }); 

i can same email address, print in html code this: data-email="xxxx@xxx.com", don't want put email address printed in html code. , don't know way achieve this.

how can pass shortcode param value ajax php file without printing in form?

if use:

    $('.contact-form').serialize() 

does help? if isn't wanted, explain bit more?

https://api.jquery.com/serialize/


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -