Is there a way to send data from a client to the server using only JS and then fill out a form on the server and then the client gets redirected to the server and see a prefilled form? I'm thinking using ajax sending a json object. But I'm not sure that will work.
I believe you misunderstand the concepts of server and client. The client is the computer you are using, the server is the computer where the website service runs.
PHP is your server-side code, which runs on the remote computer which serves the requests of the user computers.
Javasceipt is your client-side code, which runs on the computer of the users.
You need to create the HTML structure of your form as part of the HTML which is generated on your server. In your HTML structure you can have some small PHP scripts where you "inject" programmatically calculated values. Read more here.
In general, if you create a form, you not necessarily need AJAX (Asynchronous Javascript And XML). However, for advanced handling of your forms you might need to use AJAX. There are a lot of references, just use your search engines and view a few tutorials.