A
A
Alexey Romanov2016-02-24 13:36:07
JavaScript
Alexey Romanov, 2016-02-24 13:36:07

Why is php code not working when submitting ajax form?

<script type="text/javascript">
(function($){
    $(function(){
//Нажата кнопка submit
    $("#free-form").submit(function() {
        var data = $("#free-form").serialize();
        $.ajax({
            //путь до обработчика php. Валидация и отправка EMail
            url: "/wp-content/themes/law/mail.php",
            type: "POST",
            //данные
            data: data,
            cache: false,
            success: function (html) {
                $('#free-form').hide();
                $('#result').append('Спасибо, ваше сообщение отправлено!');
            }
        });
        return false;
    });
});
})(jQuery)
        </script>


php which is not working
if (isset($_POST['submit-free'])){
                                                    update_option('sumpull',++$sumpull);}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question