1

Which method from GET or Post is more suitable to use for the code displayed below and what are its advantages from one another? The code is supposed to return data based on a user's location.

  function findPark (latitude,longitude) {
  var myReq = new XMLHttpRequest();
  var serviceURL = "https://www.ratemyPlace.prg/getRating?";
  serviceURL += "lat=" + latitude;
  serviceURL += "&lng=" + longitude;
  myReq.addEventListener("load", myListener);
  myReq.open("GET", serviceURL);
  myReq.send();
SCJP
  • 17
  • 7

1 Answers1

0

Use GET.

  • this looks like a read-only operation with no side effects
  • it has no message body

see also: What is the difference between POST and GET?

Cody
  • 2,189
  • 2
  • 16
  • 29