I try to read some data from a MS-SQL database with jquery ajax:
function lesen() {
var d;
var sqlWhere = "SELECT * FROM Benutzer";
$.ajax({
type: 'POST',
url: './en.php',
data: {
daten: sqlWhere
}
}).done( function (data) {
d = $.parseJSON(data);
return d;
})
}
console.log( lesen() );
console.log( lesen () ) retuns "undefined"
And here is my question: How do I use the values which I return in the "lesen()" function? How can I access the data outside of the function?
Thank you!