Updated sender IDs add
This commit is contained in:
@@ -114,7 +114,7 @@ $(document).ready(function() {
|
||||
senderModal.show();
|
||||
});
|
||||
|
||||
// --- HANDLE FORM SUBMISSION (Actual AJAX) ---
|
||||
// --- HANDLE FORM SUBMISSION
|
||||
$form.on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -131,7 +131,10 @@ $(document).ready(function() {
|
||||
|
||||
// Determine if we are creating or updating based on the hidden ID field
|
||||
const recordId = $('#senderRecordId').val();
|
||||
const submitUrl = base_url + "/" + recordId ? "senderids/" + recordId : "senderids";
|
||||
|
||||
// Ensure you are using the correct variable name defined in your blade file (e.g., baseUrl or base_url)
|
||||
// Using template literals ensures proper formatting without accidental trailing slashes
|
||||
const submitUrl = recordId ? `${base_url}/senderids/${recordId}` : `${base_url}/senderids`;
|
||||
|
||||
// Add a hidden _method field for PUT requests if editing
|
||||
let formData = $form.serialize();
|
||||
@@ -141,7 +144,7 @@ $(document).ready(function() {
|
||||
|
||||
$.ajax({
|
||||
url: submitUrl,
|
||||
type: 'POST', // We use POST but pass _method=PUT in the data payload for Laravel
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
@@ -152,7 +155,6 @@ $(document).ready(function() {
|
||||
text: response.message || 'Sender ID record saved.',
|
||||
confirmButtonColor: '#5c4df0'
|
||||
}).then(() => {
|
||||
// Reload the page to refresh the table and KPI counts
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -303,7 +303,4 @@
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="{{ asset('public/assets/js/sender-ids.js') }}"></script>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user