Jump to content

sending values between functions.


schme16

Recommended Posts

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...

Link to comment
https://forums.phpfreaks.com/topic/109919-sending-values-between-functions/
Share on other sites

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.