2

I understand that GET is typically associated with a URL where you can put in the browser and get the exact action done again, like viewing a profile for a particular person.

I am implementing MVC pattern with CI, and with a $.ajax of type:GET to the following URL:

                url         : 'index.php/con/fx1',

where con is the controller, fx 1 is a function in the controller.

I can direct fx1 to any model and do anything, be it POST, DELETE, or just READ.

In this sense, what difference does it make whether I specify GET/POST/DELETE/PUT

William Sham
  • 12,849
  • 11
  • 50
  • 67

3 Answers3

7

I'm a ruby on rails developer. But the MVC pattern is common for all (including php framework). I'm described in my way.

GET    /con        #=> index  
GET    /con/1      #=> show  
GET    /con/new    #=> new  
GET    /con/1/edit #=> edit  
PUT    /con/1      #=> update  
POST   /con        #=> create  
DELETE /con/1      #=> destroy  

for more: http://en.wikipedia.org/wiki/Representational_State_Transfer

Mr. Black
  • 11,692
  • 13
  • 60
  • 85
  • 1
    for New: http://stackoverflow.com/questions/2472393/rails-new-vs-create edit: The requests (show|delete, create) are transmitted by default with the right HTTP verb (here,GET and POST). – Mr. Black Sep 17 '11 at 02:18
  • @William Sham, Please vote-up to my answer, if you are satisfied. :) – Mr. Black Sep 17 '11 at 02:33
0

The difference is in describing intent. I could, of course, submit a form using either GET or POST. The difference is that in REST a GET means one thing, a POST means another.

Even when there aren't technical reason for differentiating request types, there may be conceptual reasons for doing so.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
0

GET and POST serve very different purposes. As do PUT and DELETE. Rather than repeat what many, many others have already said on this topic, Google difference between GET and POST.

Michael Irwin
  • 3,119
  • 5
  • 24
  • 40