English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi.
I was just wondering why it would be useful to use the POST in ajax (thus with URL encoded variable passing) instead of GET? Since in ajax, we're passing variable via URL.

Thanks in advance.

2007-03-18 23:28:51 · 5 answers · asked by teebo22 1 in Computers & Internet Programming & Design

5 answers

I use ajax daily! let me count the reasons for using POST!

1) Encoding! Unicode( or any other char set) encoding is guaranteed to work with a post request. GET encoding can get sloppy with Unicode.
2) virtually unlimiited parameters, vs 666 (at most) parameters with GET.
3) Your data doesn't get logged in the apache logs, which often don't have god security!
4) get requests for ajax don't get cached in the browser anyway! so it doesn't buy you anything!

Do you want to be limited by 666? or use the infinity of POST?

2007-03-19 05:55:21 · answer #1 · answered by jake cigar™ is retired 7 · 2 0

Ajax (shorthand for asynchronous JavaScript and XML[1]) is a group of interrelated web development techniques used on the client-side to create interactive web applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. The use of Ajax techniques has led to an increase in interactive or dynamic interfaces on web pages[2][3]. Data is usually retrieved using the XMLHttpRequest object. Despite the name, the use of JavaScript and XML is not actually required, nor do the requests need to be asynchronous. - wiki MySQL is a relational database management system (RDBMS)[1] that has more than 11 million installations.[2][3] MySQL is named after Monty Widenius's daughter My. The program runs as a server providing multi-user access to a number of databases. - wiki :)

2016-03-16 22:52:54 · answer #2 · answered by Anonymous · 0 0

I don't know anything about AJAX.

Usual reason for using POST is so that end users don't get to see the data passed to your script. An obvious problem may come with a snippet like this "&password=blah" although even in POST this would be a really bad idea.

More than that though, people who want to attack your scripts look at all the variables passed and then compose their own malicious URLs. Hiding the data passed to your script is always a good idea if you can.

2007-03-18 23:35:48 · answer #3 · answered by teef_au 6 · 0 2

Use GET when the request is idempotent, meaning that multiple requests will return the same result.

The more practical difference comes in terms of payload size.In many cases browsers & servers limit the length of the URL used to send data to the server.

In general use GET to retrieve data from the server; in other words, avoid changing state on the server with a GET call.

In general, use POST methods anytime you are changing the state on the server. Unlike GET, youare required to set the Content-Type header on the XMLHttpRequest object.

Unlike GET, POST does not restrict the size of the payload that is sent to the server.

Chances are most of the requests youwill make will be GET requests

Hope this helps

2007-03-19 00:34:49 · answer #4 · answered by Smutty 6 · 2 1

The only difference between GET and POST is the prominence of the data, which is more visible in GET but is hardly hidden at all in POST.

2007-03-19 00:04:49 · answer #5 · answered by poorcocoboiboi 6 · 0 2

fedest.com, questions and answers