0

Is there a Difference between the get/post request which receive from java script or HTML FORM submit

Or both look similar to the server and there is no difference whether request is generated by javasrcipt OR request initiated from FORM submit.

Note : Please excuse me if i wasn't clear with my question. I'm not asking about difference between GET and POST. I'm asking about whether there is significant difference of the request between "FORM" submit and Javascript request which can be either get or post.

Buddhika W
  • 148
  • 1
  • 12
  • Possible duplicate: http://stackoverflow.com/questions/504947/when-should-i-use-get-or-post-method-whats-the-difference-between-them – Spencer Wieczorek Jan 23 '15 at 06:32
  • The question is not (primarily) about GET vs. POST but about HTML form submission versus HTTP requests created with JavaScript. Since the latter can be done in several ways, this is rather “too broad” than a duplicate of the old GET vs. POST question. – Jukka K. Korpela Jan 23 '15 at 09:16
  • Thanks Jukka K Korpela, u have understood my question . – Buddhika W Jan 24 '15 at 00:38

4 Answers4

3

The difference between a get and post is how the parameters are passed. In a GET request you are limited to the size of the URL. Since the parameters passed along are sent in ?foo=bar as attached to the URL. A post they are sent along as post params and can be sent as key value pair or just raw data to the server to read. Which can be much longer. There are also other differences like a POST can't be accessed from a standard browser URL you have to supply the POST method in the HTTP request to access it as well. Same way goes for other HTTP methods as well like PATCH and DELETE and OPTIONS.

Asheliahut
  • 861
  • 6
  • 11
0

If you use get method then your information send by the form is visible in address bar but in POST method it is not. POST method is used when you want to transfer secure information via form.

Rahul
  • 5,346
  • 5
  • 32
  • 87
0

A POST request is simply a type of HTTP request. In general, when you make one, it has data attached in one way or another. The answer to your question depends on how the form is setup to encode data, and what data you are passing as the body in Javascript. It is possible to send a JS POST request that looks identical to a form request, but without more information, I can't tell you how.

Jim Deville
  • 10,442
  • 1
  • 34
  • 47
0

The only difference would be that:

In HTML, for GET method you can see parameters passed in URL. Parameters remain in browser history because they are part of the URL.

In JavaScript, it would hardely matter if you use GET or POST. In both the cases you can check in console to figure out what parameters are been passed. And NO History will be save.

Ruprit
  • 713
  • 1
  • 6
  • 22