In several of those conversations over the last couple of weeks, I've heard someone complain about REST and using the complete HTTP verb command set. If you haven't read much on REST, you may not be that familiar with the HTTP verbs PUT and DELETE. They sit along the more familiar GET and POST as methods for working with the web.
Those 4 give you all of the elements of the normal "CRUD" operations of many apps: create, read, update and delete. The criticism I'm referring to is that most browsers and HTML don't exactly have complete setups for PUT and DELETE. On a basic level, that's true. You can't make your normal form "method" attribute just point to a DELETE or PUT and have it work out of the box.
However, that is NOT to say that the browsers don't support it at all. If you throw Javascript into the mix (and increasingly, people are willing to have Javascript support as a requirement of using their applications), you absolutely have the ability to use the rest (ha, ha) of the HTTP verbs.
Here's a minimal bit of code to demonstrate for Firefox. It works best if you install Firebug installed and watch what goes on in the Console. Just click the little green checkbox in he lower right after installing it.
Set this Javascript code in a static HTML document in a script tag in the head of the file:
var xmlhttp;
function test(){
execute('GET', 'http://uphp/testServer.php);
execute('POST', 'http://uphp/testServer.php');
execute('PUT', 'http://uphp/testServer.php');
execute('DELETE', 'http://uphp/testServer.php');
}
function execute($method,$url){
xmlhttp=new XMLHttpRequest();
xmlhttp.open($method,$url,true)
xmlhttp.send(null);
}
Adjust the URL's in the test() function to where you are going to put the testServer.php file (details in a bit).
Then put a quick button or link like this in the body of the HTML file:
<button onclick="test();">Test</button>
The test server is equally simple in PHP:
$method = $_SERVER['REQUEST_METHOD'];
switch($method) {
case "PUT":
print($method);
break;
case "GET":
print($method);
break;
case "DELETE":
print($method);
break;
case "POST":
print($method);
break;
}
Now, if you run the HTML file and hit your "test" button, you'll see all 4 types of HTTP requests go past in the console. If you expand each, you'll see that the server properly figured out which method was which.
In short, it's definitely possible to do a completely RESTful client in HTML/Javascript with about as much extra work as any other AJAX addition. There may be other reasons not to implement REST, but this particular crutch shouldn't be leaned on unless you want it knocked out from under you.