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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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