Commit 7d20c9d6 authored by Tugce Nur Tas's avatar Tugce Nur Tas

fix api_button helper $(target)

parent be95958a
Pipeline #31617 passed with stage
in 37 minutes and 53 seconds
$(() => {
$('.api-button').click(({target}) => {
const { method, url, template } = $(target).data()
const tableCell = target.closest('td')
const tableCell = $(target).closest('td')
$.ajax({ method, url, dataType: 'json' })
.done(data => {
......@@ -9,9 +9,9 @@ $(() => {
$(tableCell).append(`<p class="text-danger">Es gab einen Fehler: ${data.errors.join('; ')}</p>`)
} else {
const compiled = _.template(template, { 'variable': 'data', 'imports': { 'data': data } })
target.remove()
$(target).remove()
$(tableCell).append(compiled(data))
}
})
})
})
\ No newline at end of file
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment