Last active
October 29, 2015 16:32
-
-
Save boniattirodrigo/78e492d674eb9e2eeeae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.table').on('click', '.table__delete', function() { | |
if ($(this).parent().is(':not(:last-child)')) { | |
var linhaClicada = $(this).parent().index(); | |
console.log(linhaClicada); | |
$.ajax({ | |
type: 'POST', | |
dataType: 'json', | |
url: "/atendimento/deletar-servico-ou-item-selecionado/", | |
data: { | |
item: linhaClicada, | |
csrfmiddlewaretoken: '{{ csrf_token }}' | |
}, | |
success: function(result) { | |
console.log("Success"); | |
}, | |
error: function(result) { | |
console.log("Error"); | |
} | |
}); | |
$(this).parent().remove(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deletar_servico_ou_item_selecionado(request): | |
if request.is_ajax: | |
# import pdb; pdb.set_trace() | |
linhaClicada = request.POST['item'] | |
print(linhaClicada) | |
lista = request.session['ord-serv'] | |
del lista[linhaClicada] | |
request.session['ord-serv'] = lista | |
return HttpResponse("/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment