Why would you need to do this? Well for instance if you were using 3rd party AJAX APIs and you wanted to capture the data from them perhaps, or maybe you just have a complex form.
Or you could use this for form validation to return errors from the server without refreshing the browser, for example, if the data already exists in a database you could let the user know.
And thats it, as for the HTML form, only thing to note is that the form action calls the sendData function:
Oh and of course the post.php page, in here you could add in your validation, check the database etc... what ever you ourput to the page (using print, echo etc...) can be then sent back to your form page and displayed without the user leaving your form page or refreshing the browser.