jQuery(document).ready(function($) { // Ajax ফর্ম সাবমিশন $('.result-ajax-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var formData = form.serialize(); var button = form.find('.btn'); var originalText = button.text(); // লোডিং স্টেট button.text('Processing...').prop('disabled', true); // Ajax রিকোয়েস্ট $.ajax({ type: 'POST', url: result_ajax.ajax_url, data: formData + '&action=add_result&nonce=' + result_ajax.nonce, success: function(response) { if (response.success) { // সাফল্য মেসেজ দেখান form.prepend('
' + response.data.message + '
'); // ফর্ম রিসেট করুন form[0].reset(); // কিছুক্ষণ পর মেসেজ হাইড করুন setTimeout(function() { $('.alert').fadeOut(); }, 5000); } else { // এরর মেসেজ দেখান form.prepend('
' + response.data.message + '
'); } // বাটন রিসেট করুন button.text(originalText).prop('disabled', false); }, error: function() { // এরর মেসেজ দেখান form.prepend('
An error occurred. Please try again.
'); button.text(originalText).prop('disabled', false); } }); }); // রেজাল্ট খোঁজার ফর্ম $('#search-result-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var studentId = form.find('#student_id').val(); var examType = form.find('#exam_type').val(); if (!studentId || !examType) { alert('Please provide both Student ID and Exam Type'); return; } // Ajax রিকোয়েস্ট $.ajax({ type: 'POST', url: result_ajax.ajax_url, data: { action: 'get_result', student_id: studentId, exam_type: examType, nonce: result_ajax.nonce }, success: function(response) { if (response.success) { $('#result-display').html(response.data.html); } else { $('#result-display').html('
' + response.data.message + '
'); } }, error: function() { $('#result-display').html('
An error occurred. Please try again.
'); } }); }); });jQuery(document).ready(function($) { // Ajax ফর্ম সাবমিশন $('.result-ajax-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var formData = form.serialize(); var button = form.find('.btn'); var originalText = button.text(); // লোডিং স্টেট button.text('Processing...').prop('disabled', true); // Ajax রিকোয়েস্ট $.ajax({ type: 'POST', url: result_ajax.ajax_url, data: formData + '&action=add_result&nonce=' + result_ajax.nonce, success: function(response) { if (response.success) { // সাফল্য মেসেজ দেখান form.prepend('
' + response.data.message + '
'); // ফর্ম রিসেট করুন form[0].reset(); // কিছুক্ষণ পর মেসেজ হাইড করুন setTimeout(function() { $('.alert').fadeOut(); }, 5000); } else { // এরর মেসেজ দেখান form.prepend('
' + response.data.message + '
'); } // বাটন রিসেট করুন button.text(originalText).prop('disabled', false); }, error: function() { // এরর মেসেজ দেখান form.prepend('
An error occurred. Please try again.
'); button.text(originalText).prop('disabled', false); } }); }); // রেজাল্ট খোঁজার ফর্ম $('#search-result-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var studentId = form.find('#student_id').val(); var examType = form.find('#exam_type').val(); if (!studentId || !examType) { alert('Please provide both Student ID and Exam Type'); return; } // Ajax রিকোয়েস্ট $.ajax({ type: 'POST', url: result_ajax.ajax_url, data: { action: 'get_result', student_id: studentId, exam_type: examType, nonce: result_ajax.nonce }, success: function(response) { if (response.success) { $('#result-display').html(response.data.html); } else { $('#result-display').html('
' + response.data.message + '
'); } }, error: function() { $('#result-display').html('
An error occurred. Please try again.
'); } }); }); });