hi.
the client code:
<script type="text/javascript">
    // Backbone.emulateJSON = true ;
    //Backbone.emulateHTTP = true;
    $(document).ready(function(){
       
        var 
TodoItem=Backbone.Model.extend({urlRoot:"{{=URL('default','/api/todos')}}"});
    var todoItem2=new TodoItem();
       
    todoItem2.save({'description':'hello1d','status':'complete'});
    });
</script>

on the server :
@request.restful()        
def api():     
    response.view = 'generic.json'
    def GET(table_name,id):
        return db(db[table_name]._id==id)
    def POST(table_name,**vars):
        return db[table_name].validate_and_insert(**vars)
    def PUT(table_name,record_id,**vars):
        return db(db[table_name]._id==record_id).update(**vars)
    def DELETE(table_name,record_id):
        return db(db[table_name]._id==record_id).delete()        
    return locals()

but vars in server side is empty.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to