function deleteModel(mid){ confirm('Vuoi cancellare il modello?').done(function(){ $.ajax({ url: remoteAPIurl+'/api/v1/model/'+mid+'?api_token='+token, crossDomain: true, type: "delete", dataType: 'json', success: function(data, statusText, resObject){ console.log("model deleted"); location.href="./index.php"; }, error: function() { alert('Failed!'); } }); }); } $(function(){ $.ajax({ url: remoteAPIurl+'/api/v1/model?api_token='+token, crossDomain: true, type: "get", dataType: 'json', success: function(data, statusText, resObject){ var jsonData = resObject.responseJSON; $.each(jsonData.data, function (id, elem) { $('#modeltable tbody').append('