title: Delete record in Django db with ajax
body: <p>I must delete record from Django db use Jquery/Ajax. Can you help me?</p>
  
  <p>django /views function</p>
  
  <pre><code>def owner(request, identifer):
      x = get_object_or_404()
      if request.method == "DELETE":
          x.objects.delete()
  </code></pre>
  
  <p>ajax code here: </p>
  
  <pre><code> $(document).ready(function() {
         $(".delete").click(function(){
              var id_number = this.id;
              alert(id_number);
              $.ajax({
                 type: 'DELETE',
                 url: 'owner/{item.id}/',
                 data: 'identifer='+id_number,
                 success: function(){
                    if(data) {alert("Success!")}
              });
           });
    });
  </code></pre>