No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 84f35fc Jan 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore initial commit Jan 5, 2018
LICENSE initial commit Jan 5, 2018
ajax-contact-form.php initial commit Jan 5, 2018

AJAX Contact Form

PHP class for send emails using php mail() function.

Configure PHP

Configuration placed in variables on the top of main class in file ajax-contact-form.php.

Configure HTML

<form action="ajax-contact-form.php" class="ajax-contact-form">
    	<input type="text" name="name" placeholder="Name" required>
    	<input type="email" name="email" placeholder="Email" required>
    	<textarea name="message" rows="8" placeholder="Your Message" aria-required="true" required></textarea>
    	<input type="submit" value="Send">

    <div class="ajax-contact-form-response-success"></div>
    <div class="ajax-contact-form-response-error"></div>

Configure JS

Example with jQuery, but you can use plain JS.

$('.ajax-contact-form').on('submit', function(e) {

	var $form = $(this);
    var $responseSuccess = $form.find('.ajax-contact-form-response-success');
    var $responseError = $form.find('.ajax-contact-form-response-error');

        type: 'POST',
        url: $form.attr('action'),
        data: $form.serialize(),
        success: function(response) {
            response = JSON.parse(response);
            if (response.type && response.type === 'success') {
            } else {
        error: function(response) {


We created this class for our premium templates


Copyright (c) 2018 nK Licensed under the MIT license.