AntiBK/admin/module/add.php
Ivor Barhansky 36bf662112 code-upload (#1)
Upload code

Изменил(а) на 'README.md'

Изменил(а) на 'README.md'

Reviewed-on: https://src.lopar.us/lopar/AntiBK/pulls/1
Co-Authored-By: Ivor Barhansky <lopar@noreply.lopar.us>
Co-Committed-By: Ivor Barhansky <lopar@noreply.lopar.us>
2021-02-11 16:13:04 +00:00

40 lines
1.3 KiB
PHP

<?
defined('AntiBK') or die("Доступ запрещен!");
?>
<script>
$(function (){
$('body').on('change', '[name=section]', function (){
$('#types').html('');
$('#fields').html('');
$.post('ajax.php', {'do': 'showtypes', 'section': $(this).val()}, function (data){
$('#types').html(data);
});
}).on('change', '[name=type]', function (){
$('#fields').html('');
$.post('ajax.php', {'do': 'showfields', 'type': $(this).val()}, function (data){
$('#fields').html(data);
});
}).on('click', '[name=create]', function (){
var fields = '';
$('.field').each(function (){if ($(this).val()) fields += $(this).attr('name')+'='+$(this).val()+'$$';});
$.post('ajax.php', {'do': 'createitem', 'fields': fields}, function (data){
if (data == 'complete')
alert('Предмет создан');
else
alert(data);
});
$('#fields').html('');
$.post('ajax.php', {'do': 'showfields', 'type': $('[name=type]').val()}, function (data){
$('#fields').html(data);
});
});
});
</script>
Тип предмета:
<select class='field' name="section">
<option value="" selected></option>
<option value="item">item</option>
<option value="thing">thing</option>
</select>
<font id='types'></font>
<font id='fields'></font>