You would need to put the alerts inside the post callback as well. The
request response is probably coming back AFTER all of the JS has been
processed on page load.
Blair
On 12/5/06, kazaar <[EMAIL PROTECTED]> wrote:
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
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/