PUT Support for Jeditable

Blog Projects
javascript jquery jeditable

Until now Jeditable only supported submitting edited data using POST method. This was against REST principles. POST should be used for creating new objects. PUT should be used for updating existing objects.

Most browsers do not natively support PUT method. Jeditable does it Rails way by using POST method but submitting additional variable called _method with value put.

Jeditable now has basic unit tests covering most configuration parameters. If you find any failing tests drop me a line. Download latest as source, minified or packed.

Changes Since 1.6.0

Submit method can now be POST (default) or PUT.

$(".editable").editable("http://www.example.com/save.php", { 
    method : "PUT"

Bug where form was submitting twice if using code like below was fixed. Thanks to Hannes Tydén of soundcloud.com for patch.

$(".editable").editable("http://www.example.com/save.php", { 
    settings.submit : '<button type="submit">Save</button>'

Note that code below generates exactly the same HTML as code above.

$(".editable").editable("http://www.example.com/save.php", { 
    settings.submit : 'Save'

When asking a question include an URL to example page where the problem occurs. Even better is to make a Fiddle which demonstrates the problem. If you have longer code examples please use pastie.org.