I m trying to send email through contact page using PHP and Ajax.
The HTML Code
<div class=”row”>
<div class=”col-md-6 form-group”>
<input name=”fullName” id=”fullName” type=”text” class=”form-control” placeholder=”Full Name” required>
</div>
<div class=”col-md-6 form-group”>
<input name=”emailID” type=”email” id=”emailID” class=”form-control” placeholder=”Email ID” required>
</div>
<div class=”col-md-6 form-group”>
<input name=”mobileNumber” id=”mobileNumber” type=”text” class=”form-control” placeholder=”Mobile Number” required>
</div>
<div class=”col-md-6 form-group”>
<input name=”subject” id=”subject” type=”text” class=”form-control” placeholder=”Subject” required>
</div>
<div class=”col-12 form-group”>
<textarea name=”message” id=”message” class=”form-control” rows=”3″ placeholder=”Message” required></textarea>
</div>
<div class=”col-12″>
<input name=”submit” type=”submit” class=”btn btn-success” value=”Send”>
<div id=”status”></div>
</div>
</div>
The Javascript Code
function sendContact() {
jQuery.ajax({
url: “mail.php”,
data:’fullName=’+$(“#fullName”).val()+’&emailID=’+$(“#emailID”).val()
+’&subject=’+$(“#subject”).val()+’&message=’+$(message).val(),
type: “POST”,
success:function(data){
$(“#status”).html(data);
},
error:function (){}
});
}