diff --git a/public/assets/js/sender-ids.js b/public/assets/js/sender-ids.js
index cd1894d..256b580 100644
--- a/public/assets/js/sender-ids.js
+++ b/public/assets/js/sender-ids.js
@@ -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();
});
}
diff --git a/resources/views/senderids/index.blade.php b/resources/views/senderids/index.blade.php
index 3ea891c..c398add 100644
--- a/resources/views/senderids/index.blade.php
+++ b/resources/views/senderids/index.blade.php
@@ -303,7 +303,4 @@
@push('scripts')
-
@endpush
\ No newline at end of file