'; $('#result').html(result); $('#tableResult').show(); }, complete: function () { $('#showLoading5').hide(); }, }); }); $('#statePoll').change(function () { let state_id = document.getElementById('statePoll').value; let link = "/wp-content/themes/independent-national-electoral-commission/custom/views/lgaView.php"; // let link = "view/lgaView.php"; $.ajax({ type: 'POST', url: link, data: {state_id: state_id}, beforeSend: function () { $('#lgaDiv').hide(); $('#showLoading1').show(); }, success: function (data) { let json = JSON.parse(data); $('#result tr').empty(); $('#lgaPoll').empty(); $('#tableResult').hide(); $('#lgaPoll').append('Choose Lga'); $.each(json, (k, v) => { $('#lgaPoll').append('' + v.name + ''); }); $('#lgaDiv').show(); $('#warDiv').hide(); $('#unitDiv').hide(); }, complete: function () { $('#showLoading1').hide(); }, }); }); $('#lgaPoll').change(function () { let lga_id = document.getElementById('lgaPoll').value; let state_id = document.getElementById('statePoll').value; let link = "/wp-content/themes/independent-national-electoral-commission/custom/views/wardView.php"; // let link = "view/wardView.php"; $.ajax({ type: 'POST', url: link, data: {lga_id: lga_id, state_id: state_id}, beforeSend: function () { $('#warDiv').hide(); $('#showLoading2').show(); }, success: function (data) { let json = JSON.parse(data); $('#result tr').empty(); $('#wardPoll').empty(); $('#tableResult').hide(); $('#wardPoll').append('Choose Ward'); $.each(json, (k, v) => { $('#wardPoll').append('' + v.name + ''); }); $('#warDiv').show(); $('#unitDiv').hide(); }, complete: function () { $('#showLoading2').hide(); }, }); }); $('#wardPoll').change(function () { let lga_id = document.getElementById('lgaPoll').value; let state_id = document.getElementById('statePoll').value; let ward_id = document.getElementById('wardPoll').value; let link = "/wp-content/themes/independent-national-electoral-commission/custom/views/unitView.php"; // let link = 'view/unitView.php'; $.ajax({ type: 'POST', url: link, data: {lga_id: lga_id, state_id: state_id, ward_id: ward_id}, success: function (data) { let json = JSON.parse(data); $('#unitPoll').empty(); $('#unitPoll').append('Choose Polling Unit'); $.each(json, (k, v) => { $('#unitPoll').append('' + v.name + ''); }); $('#SearchPoll').show(); $('#unitDiv').show(); }, }); }); $('#unitPoll').change(function () { $('#result tr').empty(); $('#SearchPoll').show(); }); /* ELECTION RESULT SCRIPT */ $('#submitButton').click(function (e) { e.preventDefault(); let el_type_id = document.getElementById('sel_subtype').value; let el_cat_id = document.getElementById('sel_type').value; let el_state_id = document.getElementById('sel_state').value; let el_const_id = document.getElementById('sel_const').value; let el_zone_id = document.getElementById('sel_zone').value; let el_lga_id = document.getElementById('sel_lga').value; let el_year_id = document.getElementById('sel_year').value; let el_sha_id = document.getElementById('sel_sha').value; if (el_type_id == '') { alert('Please select election type'); } else if (el_type_id !== '' && el_cat_id == '1') { let link = "/wp-content/themes/independent-national-electoral-commission/custom/views/resultView.php"; $.ajax({ type: 'POST', url: link, data: {pres_type_id: el_type_id, pres_cat_id: el_cat_id, pres_year: el_year_id}, beforeSend: () => { $('#table_showLoading5').show(); }, success: (data) => { let table = '