This first method of doing a php post without a form involves using FormData() constructor which essentially sends post data to php without having to have a form or any controls on the web page. Its an effective way to submit data to php tricking php into thinking its form data.
This second method of sending post data/javascript variables to php is sort like a hybrid between a POST and a GET request, even though it is really a POST request.
Of course dont forget to include the rest of the required ajax request Javascript code ...