Welcome to WebmasterWorld Guest from 54.146.194.42

Forum Moderators: open

Message Too Old, No Replies

Passing a var to another func?

     
12:45 pm on Oct 16, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0


I've got this:

function foo (a) {
var bar = arguements[1];
new Ajax.Request('foo/bar/site',{
method: 'get',
onSuccess: function (r) {
if (bar) { ... }
}
});
}

Now, I can't for the life of me figure out how to get 'bar' within the onSuccess function to work. I hope that makes sense!

2:22 am on Oct 30, 2007 (gmt 0)

New User

5+ Year Member

joined:Oct 14, 2007
posts:14
votes: 0


At a glance, I'd suggest this little edit:

instead of:
function foo (a) {
var bar = arguements[1];

do this:
function foo (a) {
var bar = arguments[0];

I assume "arguements" was a typo, but you definitely need to access the first value of the arguments, beginning with arguments[0]

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members