6
I created a function that takes the values of a JSON and (should send these values to variables within the function) so I could use these variables in the function continuation. The problem is that when I run the function it does not return the values... if I take the internal code of the same and run in the DOM it works but calling it does not... Somebody give me a hand please?
//get connection info's to access the system
function connection(){
//vars
var servername;
var database;
var username;
var password;
//get JSON values
$.getJSON('./data/configuration.json',function(data){
servername = data.servername;
database = data.database;
username = data.username;
password = data.password;
});
console.log(servername);
console.log(database);
console.log(username);
console.log(password);
}