PUT vs. GET
Posted: Thu Apr 30, 2009 4:41 am
The title says it all, really. I'm studying the Symfony framework, and I'm completely loving it--partly due to the excellence of their tutorial. Anyway, I keep getting stuck at the PUT HTTP method. See this page, near the end.
This code:
Generates this link:
Basically, why would one use PUT as opposed to GET in a certain case? And why would they even call it PUT when it seems that the form method set up by the javascript is actually POST.
This code:
Code: Select all
<?php echo link_to('Publish', 'job_publish', $job, array('method' => 'put')) ?>Code: Select all
<a href="/frontend_dev.php/job/c55fb50ef1d38aeb1c21b2361e6034b870eee5a5/publish" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'post'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'sf_method'); m.setAttribute('value', 'put'); f.appendChild(m);var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_csrf_token'); m.setAttribute('value', 'c14237ea8513e519b8d307661bed3a6d'); f.appendChild(m);f.submit();return false;">Publish</a>