testing
This commit is contained in:
@ -109,7 +109,6 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="/" class="btn-go-back">← Back to Main</a>
|
||||
|
||||
<div class="container">
|
||||
<h2>Clients Table</h2>
|
||||
@ -162,10 +161,10 @@
|
||||
|
||||
<div style="margin-top: 30px; text-align: center;">
|
||||
<a href="{% url 'table_one' %}">
|
||||
<button class="add-row-btn">Go to Table One</button>
|
||||
<button class="add-row-btn">Go to Helium input</button>
|
||||
</a>
|
||||
<a href="{% url 'table_two' %}">
|
||||
<button class="add-row-btn">Go to Table Two</button>
|
||||
<button class="add-row-btn">Go to Table output</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -189,20 +188,18 @@
|
||||
let address = $('#add-address').val();
|
||||
|
||||
$.ajax({
|
||||
url: `/add-entry/${currentModelName}/`,
|
||||
url: `/add-entry/Client/`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
'name': name,
|
||||
'address': address,
|
||||
'age': 0,
|
||||
'email': 'none@example.com',
|
||||
'csrfmiddlewaretoken': '{{ csrf_token }}'
|
||||
},
|
||||
success: function (response) {
|
||||
let rowCount = $('tbody tr').length + 1;
|
||||
let newRow = `
|
||||
<tr data-id="${response.id}">
|
||||
<td>${rowCount}</td> <!-- Serial number -->
|
||||
<td>${rowCount}</td>
|
||||
<td>${response.id}</td>
|
||||
<td>${response.name}</td>
|
||||
<td>${response.address}</td>
|
||||
@ -214,6 +211,9 @@
|
||||
`;
|
||||
$('tbody').append(newRow);
|
||||
$('#add-popup').fadeOut();
|
||||
},
|
||||
error: function (xhr) {
|
||||
alert('Failed to add client: ' + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -272,7 +272,14 @@
|
||||
success: function (response) {
|
||||
if (response.status === 'success') {
|
||||
row.fadeOut(300, function () { $(this).remove(); });
|
||||
} else {
|
||||
alert('Delete failed: ' + response.message);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert('Delete request failed:\n' + xhr.responseText);
|
||||
console.log('Error:', error);
|
||||
console.log('Status:', status);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user