Skip to content

Commit 78b6ba9

Browse files
fix: execute addThresholdTemplate POST directly instead of binding click
The function was called via inline onClick, but it just bound another click handler - which never fired because the click event had already completed. Execute the POST directly in the function. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1 parent cabb181 commit 78b6ba9

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

setup.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,15 +1503,13 @@ function thold_device_template_edit() {
15031503
</table>
15041504
<script type='text/javascript'>
15051505
function addThresholdTemplate() {
1506-
$('#add_tt').on('click', function() {
1507-
scrollTop = $(window).scrollTop();
1508-
$.post('host_templates.php?header=false&action=item_add_tt', {
1509-
host_template_id: $('#id').val(),
1510-
thold_template_id: $('#thold_template_id').val(),
1511-
__csrf_magic: csrfMagicToken})
1512-
.done(function(data) {
1513-
loadPageNoHeader(urlPath+'host_templates.php?header=false&action=edit&id='+$('#id').val());
1514-
});
1506+
scrollTop = $(window).scrollTop();
1507+
$.post('host_templates.php?header=false&action=item_add_tt', {
1508+
host_template_id: $('#id').val(),
1509+
thold_template_id: $('#thold_template_id').val(),
1510+
__csrf_magic: csrfMagicToken})
1511+
.done(function(data) {
1512+
loadPageNoHeader(urlPath+'host_templates.php?header=false&action=edit&id='+$('#id').val());
15151513
});
15161514
}
15171515
</script>

0 commit comments

Comments
 (0)