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();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user