Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-01-2011, 04:41 PM   PM User | #1
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 796
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
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.
tomharto is offline   Reply With Quote
Old 06-01-2011, 08:47 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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)
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Users who have thanked rnd me for this post:
tomharto (06-01-2011)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:52 PM.


Advertisement
Log in to turn off these ads.