js deleting submitted form data

后端 未结 1 861
旧时难觅i
旧时难觅i 2021-01-29 03:22

The problem: Javascript function( which was premade by template) cleans the form data sent to me by php

The php code:



        
相关标签:
1条回答
  • 2021-01-29 04:21

    You haven't provided the data argument for $.post

    Try

    var form = $('.contact-form');
    form.submit(function () {'use strict',
        var $this = $(this);    
        $.post($(this).attr('action'), $this.serialize(), function(data) {
            $this.prev().text(data.message).fadeIn().delay(3000).fadeOut();
        },'json');
        return false;
    });
    

    References:

    jQuery.post() Docs

    jQuery.serialize() Docs

    0 讨论(0)
提交回复
热议问题