PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
httpdocs
/
apilora-sdoppio
/
js
$(document).ready(function () { getSelectData(); }); // resetta le select e le popola tramite le richieste function getSelectData() { clearTable(); getAllTracker(); } // richiede i dati tramite AJAX e popola la select con i dati estratti relativi alle missioni disponibili function getAllTracker() { $.ajax({ "async": true, type: "GET", url: "api.php", data: {request: "getAllAgent"}, dataType: 'json', success: function (data) { console.log(data); if (typeof data !== 'undefined' && data.length === 0) { $('#agent-list').append("Nessun tracker presente"); } else { $.each(data, function (i, item) { stateMessagge = (item.mission_end != null || item.mission == null) ? 'Disponibile' : 'In missione'; state = (item.mission_end != null || item.mission == null) ? 'success' : 'danger'; item.mission = (item.mission == null) ? 'Nuovo agente' : item.mission; $('#agent-list').append("<tr><td>" + item.name + "</td><td>" + item.identification_number + "</td><td>" + item.grade + "</td><td>" + item.mission + "</td><td class='" + state + "'>" + stateMessagge + "</td></tr>"); }); } }, error: function (request, status, error) { if (status !== 'abort') { alert(error + ' - Errore incontrato durante l\'elaborazione dei dati, la pagina verrĂ ricaricata.'); location.reload(); } } }); } function clearTable() { $('#agent-list').empty(); } $("#request-form").submit(function (e) { $.ajax({ type: "POST", url: "api.php", data: $("#request-form").serialize(), success: function () { $("#submit-error").hide(); $("#submit-success").show(); getSelectData(); }, error: function () { $("#submit-success").hide(); $("#submit-error").show(); } }); e.preventDefault(); // avoid to execute the actual submit of the form. });
[-] timepicker.js
[open]
[-] trackers-control.js
[open]
[-] track.js
[open]
[+]
..
[-] assign_mission.js
[open]
[-] history.js
[open]
[-] old_from-submit.js
[open]
[-] agents-control.js
[open]
[-] nice-date-picker.js
[open]
[-] mission_control.js
[open]
[-] seed.js
[open]