jQuery AJAX form using mail() PHP script sends email, but POST data from HTML form is undefined

前端 未结 6 1617
青春惊慌失措
青春惊慌失措 2020-11-27 05:07

Thanks for taking the time to look, guys. I\'m creating a pretty basic AJAX contact form using jQuery. The email sends, but upon opening the email there is no POST data, so

6条回答
  •  感情败类
    2020-11-27 05:53

    You're using the wrong post parameters:

        var dataString = 'name='+ name + '&email=' + email + '&text=' + text;
                          ^^^^-$_POST['name']
                                           ^^^^--$_POST['name']
                                          etc....
    

    The javascript/html IDs are irrelevant to the actual POST, especially when you're building your own data string and don't use those same IDs.

提交回复
热议问题