For my job, I was looking through a few javascript files, and found a few AJAX calls that used POST, but didn’t send any data. It seems they used to, but the backend was updated, and the data wasn’t needed, and the previous developers left them as POSTs (or they just copied & pasted the $.ajax calls from other files, and removed the data values).
I changed these empty POST requests to GET requests. I’m assuming it’s more efficient to use a GET instead of an empty POST. I’ve looked, and haven’t found anything useful.
So, is it more efficient to use a GET instead of a POST with no data sent?
I would argue that GET vs. POST isn’t an efficiency question so much as a semantic question. What is the intent of the POST requests? If the intent is to alter the state of the system in some way, then I would recommend leaving them as POSTs. If the intent is simply to retrieve some data from the system, then I would change them over to GETs.
The issue of data parameters doesn’t really come into play as both GET and POST requests can accept parameters. (GET on the query string and POST via post data)
Outside of theoretical concerns, there are real reasons to use GET or POST. For instance, GET requests can be cached by web servers, proxy servers and clients, whereas POST requests are never cached AFAIK. I’m sure there are other differences, but adhering to the semantic nature of the requests should take care of them for you.