$("#thing-input").todoify({ container: "#thing-todos", template: "<section><header><%= todo %></header><a>remove</a></section>", renderItem: function(item) { var cont = this.renderTemplate(item); cont.find("a").click(function(event){ cont.remove(); }); return cont; } });
½øÒ»²½¸Ä½øÄ¿Ç°£¬todoify»¹Ã»ÓÐÓëºǫ́½øÐÐÈκεÄͨÐÅ£¬Èç¹û¿ÉÒԺͺǫ́µÄRESTFulµÄAPI¼¯³ÉµÄ»°£¬Õâ¸ö²å¼þ½«»áÓиü¶àµÄʹÓó¡¾°¡£
¼òµ¥À´½²£¬Ö»ÐèҪΪ²å¼þÌṩ¸ü¶àÑ¡Ï²¢Ìṩ»Øµ÷º¯Êý¼´¿É£¬±ÈÈ磺
$("#input").todoify({ restful: 'http://app/todos', onadd: function(item){ //... }, ondelete: function(item){ //... } })
È»ºó¼ÓÈëһЩajaxµÄµ÷Óü´¿É¡£
¡¡