//loop through individual logins
$rootScope.setting.instances.forEach(function(ins) {
var header = {
"Accept": "application/json",
"Authorization": "Basic " + btoa( ins.uname + ':' + ins.pword ),
"Access-Control-Allow-Origin" : "*",
"Access-Control-Allow-Methods" : "GET, POST, DELETE, PUT, JSONP"
};
$http({ method : 'post', url : ins.url, headers: header })
.success( function( data )
{
console.log( ins.name +" login success" );
$("#fail" + ins.id ).hide();
$("#succ" + ins.id ).show();
//logins : an app.js global variable
logins.push('{"ins" : '+ ins.id + ',"isAvailable" : "true"}');
checkFinished();
})
.error( function( data)
{
console.log( ins.name +" login failed" );
$("#fail" + ins.id ).show();
$("#succ" + ins.id ).hide();
//logins : an app.js global variable
logins.push('{"ins" : '+ ins.id + ',"isAvailable" : "false"}');
checkFinished();
});
});
}