вот теперь точно заработало (наверн)

This commit is contained in:
malimova 2024-05-03 21:55:49 +04:00
parent 056df448a6
commit 81ca3c189d

View File

@ -8,28 +8,23 @@
<div class="row"> <div class="row">
<div class="col-4">Изделие:</div> <div class="col-4">Изделие:</div>
<div class="col-8"> <div class="col-8">
<select id="pastry" name="pastry" class="form-control" aspitems="@(new SelectList(@ViewBag.Pastrys,"Id", "ProductName"))"></select> <select id="pastry" name="pastry" class="form-control" asp-items="@(new SelectList(@ViewBag.Pastrys,"Id", "PastryName"))"></select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Количество:</div> <div class="col-4">Количество:</div>
<div class="col-8"> <div class="col-8"><input type="text" name="count" id="count" /></div>
<input type="text" name="count" id="count" />
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Сумма:</div> <div class="col-4">Сумма:</div>
<div class="col-8"> <div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
<input type="text" id="sum" name="sum" readonly />
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-8"></div> <div class="col-8"></div>
<div class="col-4"> <div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
<input type="submit" value="Создать" class="btn btn-primary" />
</div>
</div> </div>
</form> </form>
<script> <script>
$('#pastry').on('change', function () { $('#pastry').on('change', function () {
check(); check();
@ -37,10 +32,11 @@
$('#count').on('change', function () { $('#count').on('change', function () {
check(); check();
}); });
function check() { function check() {
var count = $('#count').val(); var count = $('#count').val();
var pastry = $('#pastry').val(); var pastry = $('#pastry').val();
if (count && product) { if (count && pastry) {
$.ajax({ $.ajax({
method: "POST", method: "POST",
url: "/Home/Calc", url: "/Home/Calc",
@ -51,4 +47,4 @@
}); });
}; };
} }
</script> </script>