Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rafiahmedd/c18f7a5b6b6ed42dc2e4fdd681aeaea2 to your computer and use it in GitHub Desktop.
Save rafiahmedd/c18f7a5b6b6ed42dc2e4fdd681aeaea2 to your computer and use it in GitHub Desktop.
Send Message to whatsapp after submiting the form
//Method 1
var form = $('#fluentform_1976'); //YOUR FORM ID HERE
form.on('submit',function(){
var firstName = $('#ff_1976_names_first_name_').val(); // YOUR FORM INPUT NAME ID HERE
var lastName = $('#ff_1976_names_last_name_').val(); // YOUR FORM INPUT NAME ID HERE
window.location = 'http://api.whatsapp.com/send?phone=5521997832127&text=Quero-Desenhar%0A%20'+firstName+'%20'+lastName;
});
//Method 2
var firstNameKey = "first_name"; // give your first name fields Name attributes
var lastNameKey = "last_name"; // give your last name fields Name attributes
var phoneNummber = "5521997832127" // give your mobile number
var text = "Quero-Desenhar%0A%20"; //give your texts
$form.on('submit',function(){
var firstName = $(this).find("input[name='names["+firstNameKey+"]']").val();
var lastName = $(this).find("input[name='names["+lastNameKey+"]']").val();
window.location = 'http://api.whatsapp.com/send?phone='+phoneNummber+'&text='+text+''+firstName+'%20'+lastName;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment