jQuery.Model.static.destroy  function     

Destroy is used to remove a model instance from the server. By implementing destroy along with the rest of the service api, your models provide an abstract service API.

You can implement destroy with a string like:

$.Model("Thing",{
  destroy : "POST /thing/destroy/{id}"
})

Or you can implement destroy manually like:

$.Model("Thing",{
  destroy : function(id, success, error){
    $.post("/thing/destroy/"+id,{}, success);
  }
})

You just have to call success if the destroy was successful.

$.Model.destroy(id, success, error)
{String|Number}

the id of the instance you want destroyed

{Function}

the callback function, it must be called with an object that has the id of the new instance and any other attributes the service needs to add.

{Function}

a function to callback if something goes wrong.

© Jupiter IT - JavaScriptMVC Training and Support