bd 7.0
This commit is contained in:
1
views/admin/ajax.php
Normal file
1
views/admin/ajax.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
@ -15,28 +15,19 @@ use itguild\forms\inputs\TextArea;
|
||||
])
|
||||
->setLabel("Название формы")
|
||||
->render();
|
||||
$form->field(TextArea::class, name: "params", params: [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'Параметры формы'
|
||||
])
|
||||
->setLabel("Параметры формы")
|
||||
->render();
|
||||
|
||||
|
||||
?>
|
||||
<button style="margin-top:15px" type="button" id="buttonAdd" class="btn btn-primary form-control" onclick="ajaxRequest()">Добавить поле</button>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
|
||||
'class' => "btn btn-primary ",
|
||||
'value' => 'Отправить',
|
||||
'typeInput' => 'submit'
|
||||
])
|
||||
->render();
|
||||
$form->endForm();
|
||||
?>
|
||||
<script>
|
||||
$.ajax({
|
||||
url:'/handler.php',
|
||||
method: 'post',
|
||||
dataType: 'html'
|
||||
data: {element: 'value', abc:'test'},
|
||||
success: function (data){
|
||||
console.log(<<Sent successfully: >> + data);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php $form->endForm(); ?>
|
||||
|
@ -9,9 +9,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php echo $title ?></title>
|
||||
<link rel="stylesheet" href="vendor/twbs/bootstrap/dist/css/bootstrap.css">
|
||||
<link rel="stylesheet" href="/vendor/twbs/bootstrap/dist/css/bootstrap.css">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
|
||||
<script src="/public/js/ajax.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
Reference in New Issue
Block a user