I must delete record from Django db use Jquery/Ajax. Can you help me?
django /views function
def owner(request, identifer):
x = get_object_or_404()
if request.method == "DELETE":
x.objects.delete()
ajax code here:
$(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!")}
});
});
});
item.idorid_number? Give some more detail of your code.