[jQuery] Setting a global variable

[jQuery] Setting a global variable


How should I change the following, so those 2 global variables would be
filled with information returned by server? Code below doesn't do it. Could
this have something to do with asyncronous loading or something?
var seed_id;
var seed;
function createSeed() {
$.post('login/login.php',{action:'createseed'}, function(data) {
results = data.split('|');
seed_id = results[0];
seed = results[1];
alert(seed_id+"|"+seed); // something like.. 1325|2ae5fa6e56fae5f67a5e
});
alert(seed_id+"|"+seed); // undefined|undefined
}
createSeed();
alert(seed_id+"|"+seed); // undefined|undefined
--
View this message in context: http://www.nabble.com/Setting-a-global-variable-tf2764461.html#a7708357
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/