I am trying to post 4 HTML form fields to a text file using AJAX & PHP
The full HTML form has other fields. The whole form will be posted to a different location after.

need some sample code if possible.

PHP variables are

PHP Code:
$username $_POST['username'];
$realname $_POST['realname'];
$phone $_POST['phone'];
$email $_POST['email'];