JSFiddle - React, Tailwind, and code Playground
HTML
<input type ="text" id="name">
<input type ="text" id="age">
<label for="male">Male</label><input type ="radio" value="M" name="gender" id="male">
<label for="female">Female</label><input type ="radio" value="F" name="gender" id="female">
<input type ="text" id="contact_no">
<input type ="text" id="city">
<input type ="text" id="concern">
<input type ="text" id="email">
<button id="submitButton">Click Me</button>
JavaScript
$(document).ready(function (){
$("#submitButton").click(function() {
var name =$("#name").val();
var age = $("#age").val();
var gender = $('input:radio[name=gender]:checked').val();
var contact_no = $("#contact_no").val();
var city = $("#city").val();
var concern = $("#concern").val();
var email = $("#email").val();
ajaxcall(name, age, gender, contact_no, city, concern, email)
})
});
function ajaxcall(name, age, gender, contact_no, city, concern, email) {
console.log("Execuitng Function" + name+age+gender+contact_no+city+concern+ email);
jQuery.ajax({
type: "POST",
url: "https://adjetter.com/lp/lead-integration.html",
data: {
name: name,
age: age,
gender: gender,
contact_no: contact_no,
city: city,
concern: concern,
email: email
},
dataType: "html",
success: function (data) {
alert();
}
});
}