如何使用jQuery将输入字段中的值传输到phpMailer文件


How to use jQuery to transfer values in input field to phpMailer file

所以我有一个带有基本文本输入字段的html表单。当按下按钮时,jquery会创建一个对象,然后将该对象发送到phpMailer文件。我该如何处理这种情况?

为此使用发布请求:

var formData = $( "#myForm" ).serialize(); //for example
$.post( "{pathToYourMailerPHP}", formData, function( res ) {
//this function will be called when php response successfull
} );