Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-01-2011, 04:41 PM #1
- Join Date
- Jul 2010
- Thanked 18 Times in 18 Posts
POST vs GET for inserting into a database
I want to use an AJAX form to insert data into a database, personally id rather use POST rather than GET but i was wondering if any were specifically better either speed wise or safety wise etc. Any input appreciated.
06-01-2011, 08:47 PM #2
- Join Date
- Jun 2007
- Thanked 608 Times in 588 Posts
GET is a lot faster, but often considered less safe than POST.
The reson is that GET is part of the URL, so it shows up in logs from your windows box to the coffershop's router to your ISP's logs, to the site's logs...
POST is not logged as such, and handles more data than GET.
Still, GET is easier to debug because the url (and all those logs) contain the actual data you passed.
You can send GET from any domain to any domain without security warnings, whist POST usually requires a real <form> and security click-through to do xdomain transfers.
if you use ajax, neither can talk to other domains.
using an image ping, you can GET to anywhere, but not from anywhere...
so, it depends on:
1. how much data you have (+2kb needs post)
2. where it's going? (same site or elsewhere)
3. security implications (don't login to a bank at starbucks using GET to submit)
Users who have thanked rnd me for this post: