schme16 Posted June 12, 2008 Share Posted June 12, 2008 I'm just starting to venture out into the vast world of AJAX, only to have stumbled on what feels a rudimentary point. I've got a function: ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4) { response = ajaxRequest.responseText; } } and I've got a global: var response = ' '; but when called the function seems not to change the variable (response) at all... I was wondering is there was a way to make it global... more global that is... I understand how to make a normal function behave correctly. But when set out like this: functionName = function() { I can't seemed to get it to work. Any help would be rewarded with admiration and gratitude... perhaps cake... Quote Link to comment https://forums.phpfreaks.com/topic/109919-sending-values-between-functions/ Share on other sites More sharing options...
schme16 Posted June 12, 2008 Author Share Posted June 12, 2008 Update! I'm an idiot. all i needed to do was make another function using the normal function functionName(){ method that gets the value sent to it and then sets the global itself. that way its sent... and in the process proving my intellectually ineptitude. also CAKE IS A LIE! Quote Link to comment https://forums.phpfreaks.com/topic/109919-sending-values-between-functions/#findComment-564054 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.