I created a small php script that returns a mysql result depending on given post/get parameters. With this file I can now use the jquery.post or .get command to retrieve something from my database.
The script always returns 1 value. So I tried to make a javascript function that returns the retrieved value from the database.
This is what I WANT it to do but I does not work like it should:
function mysql(args) {
$.post("scripts/ajax_mysql.php",args,function(data) {
return data;
});
}
var value=mysql({ table:"user", where:"nickname='test'", get:"email" });
It seems the data is retrieved when the function has already been passed. Is there a workaround for this?